summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source/rpc_parse')
-rw-r--r--source/rpc_parse/parse_lsa.c280
-rw-r--r--source/rpc_parse/parse_misc.c6
-rw-r--r--source/rpc_parse/parse_net.c9
-rw-r--r--source/rpc_parse/parse_prs.c2
-rw-r--r--source/rpc_parse/parse_samr.c24
-rw-r--r--source/rpc_parse/parse_spoolss.c532
-rw-r--r--source/rpc_parse/parse_srv.c187
7 files changed, 862 insertions, 178 deletions
diff --git a/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index 10a9efbe49d..91b54b9c836 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/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,
@@ -138,8 +137,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 +145,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 +175,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 +249,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 +275,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 +301,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 +339,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 +365,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;
}
@@ -1052,7 +1044,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,11 +1070,11 @@ 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];
- int len = strlen(name);
+ int len;
+ len = strlen(names[i]);
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], names[i], len);
}
}
@@ -1608,6 +1600,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))
@@ -1660,6 +1655,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 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.
********************************************************************/
@@ -1675,7 +1678,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 +1709,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.
********************************************************************/
@@ -1800,6 +1809,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));
}
/*******************************************************************
@@ -1822,6 +1832,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 +1889,215 @@ 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);
+ 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;
+}
+
+
+/*******************************************************************
+ 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;
+}
+
+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/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c
index afb829637c3..466653af52c 100644
--- a/source/rpc_parse/parse_misc.c
+++ b/source/rpc_parse/parse_misc.c
@@ -15,7 +15,7 @@
* 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.
- *
+ e
* 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.
@@ -554,8 +554,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;
@@ -571,7 +569,7 @@ static void create_buffer3(BUFFER3 *str, size_t len)
if (len < MAX_BUFFERLEN)
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");
diff --git a/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c
index e3f7ea5d9ae..a666258d0ce 100644
--- a/source/rpc_parse/parse_net.c
+++ b/source/rpc_parse/parse_net.c
@@ -1594,17 +1594,20 @@ 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)
+ 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));
+
+ 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;
diff --git a/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index b11dc7394da..9699a7f6de3 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/rpc_parse/parse_prs.c
@@ -615,7 +615,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);
diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c
index f207d32e55c..7fecbfb806c 100644
--- a/source/rpc_parse/parse_samr.c
+++ b/source/rpc_parse/parse_samr.c
@@ -1645,7 +1645,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));
@@ -1663,16 +1662,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;
@@ -1830,7 +1830,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));
@@ -1848,13 +1847,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;
@@ -5611,7 +5611,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))
diff --git a/source/rpc_parse/parse_spoolss.c b/source/rpc_parse/parse_spoolss.c
index 94bf6f906b7..a47b9f5b60c 100644
--- a/source/rpc_parse/parse_spoolss.c
+++ b/source/rpc_parse/parse_spoolss.c
@@ -1,11 +1,10 @@
/*
- * 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,
* Copyright (C) Jean François 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
@@ -425,8 +424,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 */
if(!prs_align(ps))
return False;
+#endif
return True;
}
@@ -612,22 +614,44 @@ 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;
- 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;
+
+ /*
+ * 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 */
+ 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))
+ 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)) {
@@ -715,6 +739,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;
@@ -871,17 +898,18 @@ 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)
********************************************************************/
-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))
@@ -898,36 +926,67 @@ 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 False;
- if (!spool_io_user_level("", &q_u->user_ctr, ps, depth))
- return False;
-
return True;
}
/*******************************************************************
- * init a structure.
+ * write a structure.
+ * called from static spoolss_r_open_printer_ex (srv_spoolss.c)
+ * called from spoolss_open_printer_ex (cli_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_r_open_printer(char *desc, SPOOL_R_OPEN_PRINTER *r_u, prs_struct *ps, int depth)
{
- DEBUG(5,("make_spoolss_q_deleteprinterdriver\n"));
+ if (r_u == NULL) return False;
+
+ prs_debug(ps, depth, desc, "spoolss_io_r_open_printer");
+ depth++;
- 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 (!smb_io_pol_hnd("printer handle",&(r_u->handle),ps,depth))
+ return False;
+
+ if (!prs_werror("status code", ps, depth, &(r_u->status)))
+ return False;
+
+ 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;
}
@@ -957,6 +1016,32 @@ BOOL spoolss_io_r_open_printer_ex(char *desc, SPOOL_R_OPEN_PRINTER_EX *r_u, prs_
}
/*******************************************************************
+ * 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.
********************************************************************/
@@ -1635,12 +1720,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;
}
@@ -1669,32 +1761,6 @@ 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)
- 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
*
@@ -1725,8 +1791,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 */
@@ -1753,7 +1825,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))
@@ -1810,7 +1882,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;
}
@@ -1849,7 +1921,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);
@@ -1999,6 +2071,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))
@@ -3662,6 +3738,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;
@@ -3741,6 +3820,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:
@@ -3943,6 +4025,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;
@@ -4529,6 +4614,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;
@@ -4909,12 +4997,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"));
@@ -4931,12 +5016,7 @@ BOOL make_spoolss_q_addprinterdriver(
case 3 :
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;
@@ -4945,11 +5025,9 @@ BOOL make_spoolss_q_addprinterdriver(
return True;
}
-BOOL make_spoolss_driver_info_3(
- TALLOC_CTX *mem_ctx,
- SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info,
- DRIVER_INFO_3 *info3
-)
+BOOL make_spoolss_driver_info_3(TALLOC_CTX *mem_ctx,
+ SPOOL_PRINTER_DRIVER_INFO_LEVEL_3 **spool_drv_info,
+ DRIVER_INFO_3 *info3)
{
uint32 len = 0;
uint16 *ptr = info3->dependentfiles;
@@ -5726,7 +5804,48 @@ 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("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;
+
+ 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)
{
@@ -5836,7 +5955,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++;
@@ -5881,7 +6000,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++;
@@ -6104,6 +6223,73 @@ BOOL spoolss_io_r_replyopenprinter(char *desc, SPOOL_R_REPLYOPENPRINTER *r_u, pr
/*******************************************************************
* 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.
+ ********************************************************************/
BOOL make_spoolss_q_reply_closeprinter(SPOOL_Q_REPLYCLOSEPRINTER *q_u, POLICY_HND *hnd)
{
@@ -6154,12 +6340,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; i<n; i++) {
+ int len;
+ uint16 *s = NULL;
+
+ if (src->size != 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;
@@ -6172,11 +6425,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;
- q_u->info.flags=PRINTER_NOTIFY_INFO_DISCARDED;
- q_u->info.count=0;
+
+ 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;
}
@@ -6678,3 +6943,78 @@ 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, 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;
+}
+
+/*******************************************************************
+ * 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;
+}
+
+/*******************************************************************
+ * 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;
+}
diff --git a/source/rpc_parse/parse_srv.c b/source/rpc_parse/parse_srv.c
index fa52b244956..3a1c13c7ea0 100644
--- a/source/rpc_parse/parse_srv.c
+++ b/source/rpc_parse/parse_srv.c
@@ -119,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;
}
@@ -208,6 +209,87 @@ static BOOL srv_io_share_info2(char *desc, SH_INFO_2 *sh2, prs_struct *ps, int d
}
/*******************************************************************
+ 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
********************************************************************/
@@ -372,7 +454,7 @@ static BOOL srv_io_share_info1005(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("misc_flags", ps, depth, &sh1005->misc_flags))
return False;
return True;
@@ -495,7 +577,33 @@ 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;
+ }
+
+ 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;
}
@@ -614,7 +722,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;
@@ -687,10 +795,17 @@ 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;
+ 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;
@@ -739,7 +854,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;
@@ -800,7 +915,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;
@@ -858,7 +973,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;
@@ -905,7 +1020,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;
@@ -1308,7 +1423,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;
@@ -1673,7 +1788,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;
@@ -1951,7 +2066,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;
@@ -2237,13 +2352,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 {
@@ -2259,7 +2374,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"));
@@ -2323,7 +2438,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;
@@ -2345,7 +2460,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;
@@ -2464,7 +2579,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;
@@ -2563,7 +2678,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;
@@ -2623,7 +2738,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;
@@ -2710,7 +2825,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;
@@ -2788,7 +2903,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;