summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_misc.c3
-rw-r--r--source3/rpc_parse/parse_net.c284
-rw-r--r--source3/rpc_parse/parse_prs.c8
-rw-r--r--source3/rpc_parse/parse_reg.c76
-rw-r--r--source3/rpc_parse/parse_spoolss.c149
-rw-r--r--source3/rpc_parse/parse_srv.c6
6 files changed, 314 insertions, 212 deletions
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 François 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; i<info->count2; 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; i<info->count1; i++)
- if (!prs_uint32("unknown20", ps, depth, &info->unknown20))
- return False;
-
- if (!prs_uint32("ptr4", ps, depth, &info->ptr4))
- return False;
+ for (i=0; i<info->num_event_audit_options; i++)
+ if (!prs_uint32("event_audit_option", ps, depth,
+ &info->event_audit_option))
+ return False;
if (!smb_io_unistr2("domain_name", &info->domain_name, True, ps, depth))
return False;
@@ -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;
@@ -1212,6 +1212,26 @@ BOOL make_spoolss_q_getprinterdata(SPOOL_Q_GETPRINTERDATA *q_u,
}
/*******************************************************************
+ * 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);
@@ -6067,18 +6089,50 @@ 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,
+ 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; i<ctr->size_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; i<ctr->size_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;
}
@@ -7514,6 +7612,21 @@ BOOL make_spoolss_q_deleteprinterdata(SPOOL_Q_DELETEPRINTERDATA *q_u,
* 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.
+ ********************************************************************/
+
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)
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;