summaryrefslogtreecommitdiffstats
path: root/source/rpc_parse
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2007-02-28 14:35:26 +0000
committerGerald Carter <jerry@samba.org>2007-02-28 14:35:26 +0000
commit80236f0d60ce013134c1ed5422d148e541f70a4f (patch)
treef71326fa71c0323e6b5d87b75b289d0608480f87 /source/rpc_parse
parentf05f5dce39b11e937fb19270b7bcc888582edf35 (diff)
downloadsamba-80236f0d60ce013134c1ed5422d148e541f70a4f.tar.gz
samba-80236f0d60ce013134c1ed5422d148e541f70a4f.tar.xz
samba-80236f0d60ce013134c1ed5422d148e541f70a4f.zip
r21585: Start syncing the monster that will become 3.0.25pre1
Still todo: * release notes * few minor outstanding patches * additional idmap man pages
Diffstat (limited to 'source/rpc_parse')
-rw-r--r--source/rpc_parse/parse_buffer.c3
-rw-r--r--source/rpc_parse/parse_dfs.c2
-rw-r--r--source/rpc_parse/parse_eventlog.c2
-rw-r--r--source/rpc_parse/parse_lsa.c14
-rw-r--r--source/rpc_parse/parse_misc.c57
-rw-r--r--source/rpc_parse/parse_net.c21
-rw-r--r--source/rpc_parse/parse_ntsvcs.c4
-rw-r--r--source/rpc_parse/parse_prs.c50
-rw-r--r--source/rpc_parse/parse_samr.c115
-rw-r--r--source/rpc_parse/parse_sec.c32
-rw-r--r--source/rpc_parse/parse_spoolss.c54
-rw-r--r--source/rpc_parse/parse_svcctl.c14
-rw-r--r--source/rpc_parse/parse_wks.c178
13 files changed, 225 insertions, 321 deletions
diff --git a/source/rpc_parse/parse_buffer.c b/source/rpc_parse/parse_buffer.c
index 21dddfa3cf5..5643189afea 100644
--- a/source/rpc_parse/parse_buffer.c
+++ b/source/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/source/rpc_parse/parse_dfs.c b/source/rpc_parse/parse_dfs.c
index fde3dc6e03a..e590aae0526 100644
--- a/source/rpc_parse/parse_dfs.c
+++ b/source/rpc_parse/parse_dfs.c
@@ -340,7 +340,7 @@ BOOL netdfs_io_dfs_Info3_d(const char *desc, NETDFS_DFS_INFO3 *v, prs_struct *ps
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)
+BOOL init_netdfs_dfs_Info4(NETDFS_DFS_INFO4 *v, const char *path, const char *comment, uint32 state, uint32 timeout, struct GUID guid, uint32 num_stores, NETDFS_DFS_STORAGEINFO **stores)
{
DEBUG(5,("init_netdfs_dfs_Info4\n"));
diff --git a/source/rpc_parse/parse_eventlog.c b/source/rpc_parse/parse_eventlog.c
index 4aff9734eed..addf433feb8 100644
--- a/source/rpc_parse/parse_eventlog.c
+++ b/source/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/source/rpc_parse/parse_lsa.c b/source/rpc_parse/parse_lsa.c
index 0b138aba1b4..e1630f79f48 100644
--- a/source/rpc_parse/parse_lsa.c
+++ b/source/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))
@@ -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);
@@ -3253,7 +3253,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))
@@ -3305,7 +3305,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;
@@ -3374,7 +3374,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;
@@ -4059,7 +4059,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;
@@ -4188,7 +4188,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/source/rpc_parse/parse_misc.c b/source/rpc_parse/parse_misc.c
index cb7c06eb459..3b1e9a4f08e 100644
--- a/source/rpc_parse/parse_misc.c
+++ b/source/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,20 @@ 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 (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, &nttime->high)) /* high part */
+ if(!prs_uint32("high", ps, depth, &high)) /* high part */
return False;
+ if (UNMARSHALLING(ps)) {
+ *nttime = (((uint64_t)high << 32) + low);
+ }
+
return True;
}
@@ -288,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)
@@ -518,7 +528,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 +627,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 +734,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);
@@ -1690,15 +1702,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 GUID*)&pol->uuid, ps, depth))
return False;
return True;
@@ -1760,10 +1766,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/source/rpc_parse/parse_net.c b/source/rpc_parse/parse_net.c
index bc6b32e6ead..2ccc9f59f68 100644
--- a/source/rpc_parse/parse_net.c
+++ b/source/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);
@@ -1522,7 +1522,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"));
@@ -1549,7 +1549,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"));
@@ -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;
@@ -3233,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"));
@@ -3291,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;
}
@@ -3307,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;
}
@@ -3330,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)
diff --git a/source/rpc_parse/parse_ntsvcs.c b/source/rpc_parse/parse_ntsvcs.c
index 599257e8020..ab5f3f75e87 100644
--- a/source/rpc_parse/parse_ntsvcs.c
+++ b/source/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/source/rpc_parse/parse_prs.c b/source/rpc_parse/parse_prs.c
index 14e190892d7..54bbe3adf6c 100644
--- a/source/rpc_parse/parse_prs.c
+++ b/source/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;
@@ -624,9 +625,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. */
@@ -1459,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 */
@@ -1624,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;
@@ -1793,3 +1795,35 @@ 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_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;
+
+ return True;
+}
diff --git a/source/rpc_parse/parse_samr.c b/source/rpc_parse/parse_samr.c
index 0bde3da26c8..27a5ef9d996 100644
--- a/source/rpc_parse/parse_samr.c
+++ b/source/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 François Micouleau 1998-2001,
+ * Copyright (C) Jean François Micouleau 1998-2001,
* Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002.
*
* This program is free software; you can redistribute it and/or modify
@@ -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,13 +553,11 @@ 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->seq_num.low = seq_num;
- u_2->seq_num.high = 0x00000000;
+ 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;
@@ -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;
}
@@ -3854,7 +3845,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 +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, uint32 *type,
+ uint32 *rid, enum lsa_SidType *type,
NTSTATUS status)
{
DEBUG(5, ("init_samr_r_lookup_names\n"));
@@ -5587,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));
@@ -5615,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;
}
@@ -5741,8 +5733,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 +5827,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 +5887,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 +5955,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 +6017,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 +6068,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 +6174,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);
@@ -6208,6 +6200,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);
@@ -6232,12 +6225,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;
@@ -6264,8 +6261,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;
@@ -6331,8 +6330,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 +6397,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 +6437,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) */
@@ -7713,6 +7712,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))
diff --git a/source/rpc_parse/parse_sec.c b/source/rpc_parse/parse_sec.c
index 6a752688a0b..76583605939 100644
--- a/source/rpc_parse/parse_sec.c
+++ b/source/rpc_parse/parse_sec.c
@@ -28,24 +28,6 @@
#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->mask))
- return False;
-
- return True;
-}
-
-/*******************************************************************
Reads or writes a SEC_ACE structure.
********************************************************************/
@@ -71,7 +53,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 */
@@ -170,14 +152,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;
}
@@ -270,9 +252,9 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
psd->off_owner_sid = 0;
}
- if (psd->grp_sid != NULL) {
+ if (psd->group_sid != NULL) {
psd->off_grp_sid = offset;
- offset += sid_size(psd->grp_sid);
+ offset += sid_size(psd->group_sid);
} else {
psd->off_grp_sid = 0;
}
@@ -321,11 +303,11 @@ BOOL sec_io_desc(const char *desc, SEC_DESC **ppsd, prs_struct *ps, int depth)
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("group_sid", psd->group_sid, ps, depth))
return False;
max_offset = MAX(max_offset, prs_offset(ps));
diff --git a/source/rpc_parse/parse_spoolss.c b/source/rpc_parse/parse_spoolss.c
index 2884883e893..90c47950af7 100644
--- a/source/rpc_parse/parse_spoolss.c
+++ b/source/rpc_parse/parse_spoolss.c
@@ -3,7 +3,7 @@
* 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) Jean François Micouleau 1998-2000,
* Copyright (C) Gerald Carter 2000-2002,
* Copyright (C) Tim Potter 2001-2002.
*
@@ -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;
@@ -2452,6 +2452,24 @@ 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,
+ 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.
********************************************************************/
@@ -2643,9 +2661,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))
@@ -3112,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
@@ -3893,7 +3917,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 <mz@seh.de>.
+ */
+ if (UNMARSHALLING(ps)) {
+ ptr_sec_desc = 1;
+ } else {
+ ptr_sec_desc = q_u->info.info_3->secdesc_ptr;
+ }
break;
}
}
@@ -3910,8 +3943,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))
@@ -6269,6 +6302,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);
diff --git a/source/rpc_parse/parse_svcctl.c b/source/rpc_parse/parse_svcctl.c
index 2cb44c63195..dc4ee3e6e99 100644
--- a/source/rpc_parse/parse_svcctl.c
+++ b/source/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/source/rpc_parse/parse_wks.c b/source/rpc_parse/parse_wks.c
deleted file mode 100644
index b6de058652b..00000000000
--- a/source/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;
-}