diff options
author | Jeremy Allison <jra@samba.org> | 2006-07-11 18:01:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:19:14 -0500 |
commit | fbdcf2663b56007a438ac4f0d8d82436b1bfe688 (patch) | |
tree | 4e42c1f061391cea3d640152fd240682cbf4fd9a /source3/rpc_parse | |
parent | 5bf62a0c3cc95abe918f3e772bb10e0a90fdce22 (diff) | |
download | samba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.tar.gz samba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.tar.bz2 samba-fbdcf2663b56007a438ac4f0d8d82436b1bfe688.zip |
r16945: Sync trunk -> 3.0 for 3.0.24 code. Still need
to do the upper layer directories but this is what
everyone is waiting for....
Jeremy.
(This used to be commit 9dafb7f48ca3e7af956b0a7d1720c2546fc4cfb8)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_eventlog.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_lsa.c | 12 | ||||
-rw-r--r-- | source3/rpc_parse/parse_ntsvcs.c | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 32 | ||||
-rw-r--r-- | source3/rpc_parse/parse_reg.c | 44 | ||||
-rw-r--r-- | source3/rpc_parse/parse_rpc.c | 11 | ||||
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 50 | ||||
-rw-r--r-- | source3/rpc_parse/parse_shutdown.c | 10 | ||||
-rw-r--r-- | source3/rpc_parse/parse_spoolss.c | 2 | ||||
-rw-r--r-- | source3/rpc_parse/parse_srv.c | 524 | ||||
-rw-r--r-- | source3/rpc_parse/parse_svcctl.c | 14 | ||||
-rw-r--r-- | source3/rpc_parse/parse_unixinfo.c | 266 |
12 files changed, 585 insertions, 386 deletions
diff --git a/source3/rpc_parse/parse_eventlog.c b/source3/rpc_parse/parse_eventlog.c index 4aff9734ee..addf433feb 100644 --- a/source3/rpc_parse/parse_eventlog.c +++ b/source3/rpc_parse/parse_eventlog.c @@ -54,7 +54,7 @@ BOOL eventlog_io_q_open_eventlog(const char *desc, EVENTLOG_Q_OPEN_EVENTLOG *q_u if(!prs_align(ps)) return False; - if ( !prs_pointer("", ps, depth, (void**)&q_u->unknown0, sizeof(EVENTLOG_OPEN_UNKNOWN0), (PRS_POINTER_CAST)prs_ev_open_unknown0)) + if ( !prs_pointer("", ps, depth, (void*)&q_u->unknown0, sizeof(EVENTLOG_OPEN_UNKNOWN0), (PRS_POINTER_CAST)prs_ev_open_unknown0)) return False; if ( !prs_unistr4("logname", ps, depth, &q_u->logname) ) diff --git a/source3/rpc_parse/parse_lsa.c b/source3/rpc_parse/parse_lsa.c index ae4cff53e4..919b7c3955 100644 --- a/source3/rpc_parse/parse_lsa.c +++ b/source3/rpc_parse/parse_lsa.c @@ -664,7 +664,7 @@ BOOL lsa_io_r_enum_trust_dom(const char *desc, LSA_R_ENUM_TRUST_DOM *out, if(!prs_uint32("count", ps, depth, &out->count)) return False; - if ( !prs_pointer("trusted_domains", ps, depth, (void**)&out->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list)) + if ( !prs_pointer("trusted_domains", ps, depth, (void*)&out->domlist, sizeof(DOMAIN_LIST), (PRS_POINTER_CAST)lsa_io_domain_list)) return False; if(!prs_ntstatus("status", ps, depth, &out->status)) @@ -3250,7 +3250,7 @@ BOOL lsa_io_r_enum_acct_rights(const char *desc, LSA_R_ENUM_ACCT_RIGHTS *out, pr if(!prs_uint32("count ", ps, depth, &out->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&out->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void*)&out->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; if(!prs_align(ps)) @@ -3302,7 +3302,7 @@ BOOL lsa_io_q_add_acct_rights(const char *desc, LSA_Q_ADD_ACCT_RIGHTS *in, prs_s if(!prs_uint32("count", ps, depth, &in->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -3371,7 +3371,7 @@ BOOL lsa_io_q_remove_acct_rights(const char *desc, LSA_Q_REMOVE_ACCT_RIGHTS *in, if(!prs_uint32("count", ps, depth, &in->count)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void*)&in->rights, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -4056,7 +4056,7 @@ BOOL lsa_io_r_query_trusted_domain_info(const char *desc, prs_debug(ps, depth, desc, "lsa_io_r_query_trusted_domain_info"); depth++; - if (!prs_pointer("trustdom", ps, depth, (void**)&r_q->info, + if (!prs_pointer("trustdom", ps, depth, (void*)&r_q->info, sizeof(LSA_TRUSTED_DOMAIN_INFO), (PRS_POINTER_CAST)lsa_io_trustdom_query) ) return False; @@ -4185,7 +4185,7 @@ BOOL lsa_io_r_query_dom_info(const char *desc, LSA_R_QUERY_DOM_INFO_POLICY *out, prs_debug(ps, depth, desc, "lsa_io_r_query_dom_info"); depth++; - if (!prs_pointer("dominfo", ps, depth, (void**)&out->info, + if (!prs_pointer("dominfo", ps, depth, (void*)&out->info, sizeof(LSA_DOM_INFO_UNION), (PRS_POINTER_CAST)lsa_io_dom_info_query) ) return False; diff --git a/source3/rpc_parse/parse_ntsvcs.c b/source3/rpc_parse/parse_ntsvcs.c index 599257e802..ab5f3f75e8 100644 --- a/source3/rpc_parse/parse_ntsvcs.c +++ b/source3/rpc_parse/parse_ntsvcs.c @@ -77,7 +77,7 @@ BOOL ntsvcs_io_q_get_device_list_size(const char *desc, NTSVCS_Q_GET_DEVICE_LIST if(!prs_align(ps)) return False; - if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) + if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) return False; if ( !prs_align(ps) ) return False; @@ -127,7 +127,7 @@ BOOL ntsvcs_io_q_get_device_list(const char *desc, NTSVCS_Q_GET_DEVICE_LIST *q_u if(!prs_align(ps)) return False; - if ( !prs_pointer("devicename", ps, depth, (void**)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) + if ( !prs_pointer("devicename", ps, depth, (void*)&q_u->devicename, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2) ) return False; if( !prs_align(ps) ) return False; diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c index 14e190892d..29a3e60aa9 100644 --- a/source3/rpc_parse/parse_prs.c +++ b/source3/rpc_parse/parse_prs.c @@ -624,9 +624,10 @@ BOOL prs_uint8(const char *name, prs_struct *ps, int depth, uint8 *data8) ********************************************************************/ BOOL prs_pointer( const char *name, prs_struct *ps, int depth, - void **data, size_t data_size, + void *dta, size_t data_size, BOOL(*prs_fn)(const char*, prs_struct*, int, void*) ) { + void ** data = (void **)dta; uint32 data_p; /* output f000baaa to stream if the pointer is non-zero. */ @@ -1793,3 +1794,32 @@ BOOL schannel_decode(struct schannel_auth_struct *a, enum pipe_auth_level auth_l return (memcmp(digest_final, verf->packet_digest, sizeof(verf->packet_digest)) == 0); } + +/******************************************************************* +creates a new prs_struct containing a DATA_BLOB +********************************************************************/ +BOOL prs_init_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +{ + if (!prs_init( prs, RPC_MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL )) + return False; + + + if (!prs_copy_data_in(prs, (char *)blob->data, blob->length)) + return False; + + return True; +} + +/******************************************************************* +return the contents of a prs_struct in a DATA_BLOB +********************************************************************/ +BOOL prs_data_blob(prs_struct *prs, DATA_BLOB *blob, TALLOC_CTX *mem_ctx) +{ + blob->length = prs_offset(prs); + blob->data = talloc_zero_size(mem_ctx, blob->length); + + if (!prs_copy_all_data_out((char *)blob->data, prs)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_reg.c b/source3/rpc_parse/parse_reg.c index fef1332e5c..1820a595ed 100644 --- a/source3/rpc_parse/parse_reg.c +++ b/source3/rpc_parse/parse_reg.c @@ -76,7 +76,7 @@ BOOL reg_io_q_open_hive(const char *desc, REG_Q_OPEN_HIVE *q_u, if(!prs_align(ps)) return False; - if(!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if(!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if(!prs_align(ps)) @@ -276,7 +276,7 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, if(!prs_uint32("access", ps, depth, &q_u->access)) return False; - if(!prs_pointer("sec_info", ps, depth, (void**)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("sec_info", ps, depth, (void*)&q_u->sec_info, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if ( q_u->sec_info ) { @@ -286,7 +286,7 @@ BOOL reg_io_q_create_key_ex(const char *desc, REG_Q_CREATE_KEY_EX *q_u, return False; } - if(!prs_pointer("disposition", ps, depth, (void**)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("disposition", ps, depth, (void*)&q_u->disposition, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1060,17 +1060,17 @@ BOOL reg_io_r_query_value(const char *desc, REG_R_QUERY_VALUE *r_u, prs_struct * if(!prs_align(ps)) return False; - if ( !prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if ( !prs_pointer("buf_max_len", ps, depth, (void**)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("buf_max_len", ps, depth, (void*)&r_u->buf_max_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("buf_len", ps, depth, (void**)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if ( !prs_pointer("buf_len", ps, depth, (void*)&r_u->buf_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -1207,17 +1207,17 @@ BOOL reg_io_q_enum_val(const char *desc, REG_Q_ENUM_VALUE *q_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("type", ps, depth, (void**)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("type", ps, depth, (void*)&q_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&q_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_pointer("buffer_len", ps, depth, (void**)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len", ps, depth, (void*)&q_u->buffer_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("name_len", ps, depth, (void**)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("name_len", ps, depth, (void*)&q_u->name_len, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -1243,17 +1243,17 @@ BOOL reg_io_r_enum_val(const char *desc, REG_R_ENUM_VALUE *r_u, prs_struct *ps, if(!prs_align(ps)) return False; - if(!prs_pointer("type", ps, depth, (void**)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("type", ps, depth, (void*)&r_u->type, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if ( !prs_pointer("value", ps, depth, (void**)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) + if ( !prs_pointer("value", ps, depth, (void*)&r_u->value, sizeof(REGVAL_BUFFER), (PRS_POINTER_CAST)smb_io_regval_buffer)) return False; if(!prs_align(ps)) return False; - if(!prs_pointer("buffer_len1", ps, depth, (void**)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len1", ps, depth, (void*)&r_u->buffer_len1, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; - if(!prs_pointer("buffer_len2", ps, depth, (void**)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("buffer_len2", ps, depth, (void*)&r_u->buffer_len2, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -1457,12 +1457,12 @@ BOOL reg_io_r_enum_key(const char *desc, REG_R_ENUM_KEY *q_u, prs_struct *ps, i if(!prs_align(ps)) return False; - if (!prs_pointer("class", ps, depth, (void**)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("class", ps, depth, (void*)&q_u->classname, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if(!prs_align(ps)) return False; - if (!prs_pointer("time", ps, depth, (void**)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) + if (!prs_pointer("time", ps, depth, (void*)&q_u->time, sizeof(NTTIME), (PRS_POINTER_CAST)smb_io_nttime)) return False; if(!prs_align(ps)) @@ -1620,12 +1620,12 @@ BOOL reg_io_q_shutdown(const char *desc, REG_Q_SHUTDOWN *q_u, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -1680,12 +1680,12 @@ BOOL reg_io_q_shutdown_ex(const char *desc, REG_Q_SHUTDOWN_EX *q_u, prs_struct * if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_u->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -1759,7 +1759,7 @@ BOOL reg_io_q_abort_shutdown(const char *desc, REG_Q_ABORT_SHUTDOWN *q_u, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_u->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; diff --git a/source3/rpc_parse/parse_rpc.c b/source3/rpc_parse/parse_rpc.c index 2d166c773b..240cac886c 100644 --- a/source3/rpc_parse/parse_rpc.c +++ b/source3/rpc_parse/parse_rpc.c @@ -191,6 +191,16 @@ interface/version dce/rpc pipe identification }, 0x00 \ } +#define SYNT_UNIXINFO_V0 \ +{ \ + { \ + 0x9c54e310, 0xa955, 0x4885, \ + { 0xbd, 0x31 }, \ + { 0x78, 0x78, \ + 0x71, 0x47, 0xdf, 0xa6 } \ + }, 0x00 \ +} + #define SYNT_NTSVCS_V1 \ { \ { \ @@ -222,6 +232,7 @@ const struct pipe_id_info pipe_names [] = { PIPE_SHUTDOWN, SYNT_SHUTDOWN_V1 , PIPE_SHUTDOWN , TRANS_SYNT_V2 }, { PIPE_SVCCTL , SYNT_SVCCTL_V2 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { PIPE_EVENTLOG, SYNT_EVENTLOG_V0 , PIPE_EVENTLOG , TRANS_SYNT_V2 }, + { PIPE_UNIXINFO, SYNT_UNIXINFO_V0 , PIPE_UNIXINFO , TRANS_SYNT_V2 }, { PIPE_NTSVCS , SYNT_NTSVCS_V1 , PIPE_NTSVCS , TRANS_SYNT_V2 }, { NULL , SYNT_NONE_V0 , NULL , SYNT_NONE_V0 } }; diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 9026d503c3..26da7b426d 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -3854,7 +3854,7 @@ BOOL samr_io_r_query_aliasinfo(const char *desc, SAMR_R_QUERY_ALIASINFO *out, if(!prs_align(ps)) return False; - if ( !prs_pointer("alias", ps, depth, (void**)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr)) + if ( !prs_pointer("alias", ps, depth, (void*)&out->ctr, sizeof(ALIAS_INFO_CTR), (PRS_POINTER_CAST)samr_alias_info_ctr)) return False; if(!prs_align(ps)) return False; @@ -4896,7 +4896,7 @@ inits a SAMR_R_LOOKUP_NAMES structure. NTSTATUS init_samr_r_lookup_names(TALLOC_CTX *ctx, SAMR_R_LOOKUP_NAMES * r_u, uint32 num_rids, - uint32 *rid, uint32 *type, + uint32 *rid, enum SID_NAME_USE *type, NTSTATUS status) { DEBUG(5, ("init_samr_r_lookup_names\n")); @@ -5741,8 +5741,8 @@ void init_sam_user_info23W(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z copy_unistr2(&usr->uni_workstations, wkstas); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - copy_unistr2(&usr->uni_unknown_str, unk_str); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_comment, unk_str); + init_uni_hdr(&usr->hdr_comment, &usr->uni_comment); copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); @@ -5835,8 +5835,8 @@ void init_sam_user_info23A(SAM_USER_INFO_23 * usr, NTTIME * logon_time, /* all z init_unistr2(&usr->uni_workstations, wkstas, UNI_FLAGS_NONE); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - init_unistr2(&usr->uni_unknown_str, unk_str, UNI_FLAGS_NONE); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + init_unistr2(&usr->uni_comment, unk_str, UNI_FLAGS_NONE); + init_uni_hdr(&usr->hdr_comment, &usr->uni_comment); init_unistr2_from_datablob(&usr->uni_munged_dial, &blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); @@ -5895,7 +5895,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, return False; if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */ return False; - if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */ return False; if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */ return False; @@ -5963,7 +5963,7 @@ static BOOL sam_io_user_info23(const char *desc, SAM_USER_INFO_23 * usr, if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ return False; - if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth)) /* unknown string */ return False; if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth)) @@ -6025,7 +6025,7 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str return False; if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */ return False; - if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */ return False; if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */ return False; @@ -6076,7 +6076,7 @@ static BOOL sam_io_user_info25(const char *desc, SAM_USER_INFO_25 * usr, prs_str if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ return False; - if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + if(!smb_io_unistr2("uni_comment ", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth)) /* unknown string */ return False; if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial, usr->hdr_munged_dial.buffer, ps, depth)) @@ -6182,8 +6182,8 @@ void init_sam_user_info21W(SAM_USER_INFO_21 * usr, copy_unistr2(&usr->uni_workstations, wkstas); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - copy_unistr2(&usr->uni_unknown_str, unk_str); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + copy_unistr2(&usr->uni_comment, unk_str); + init_uni_hdr(&usr->hdr_comment, &usr->uni_comment); copy_unistr2(&usr->uni_munged_dial, mung_dial); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); @@ -6331,8 +6331,8 @@ NTSTATUS init_sam_user_info21A(SAM_USER_INFO_21 *usr, struct samu *pw, DOM_SID * init_unistr2(&usr->uni_workstations, workstations, UNI_STR_TERMINATE); init_uni_hdr(&usr->hdr_workstations, &usr->uni_workstations); - init_unistr2(&usr->uni_unknown_str, NULL, UNI_STR_TERMINATE); - init_uni_hdr(&usr->hdr_unknown_str, &usr->uni_unknown_str); + init_unistr2(&usr->uni_comment, NULL, UNI_STR_TERMINATE); + init_uni_hdr(&usr->hdr_comment, &usr->uni_comment); init_unistr2_from_datablob(&usr->uni_munged_dial, &munged_dial_blob); init_uni_hdr(&usr->hdr_munged_dial, &usr->uni_munged_dial); @@ -6398,7 +6398,7 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, return False; if(!smb_io_unihdr("hdr_workstations", &usr->hdr_workstations, ps, depth)) /* wkstas user can log on from */ return False; - if(!smb_io_unihdr("hdr_unknown_str ", &usr->hdr_unknown_str, ps, depth)) /* unknown string */ + if(!smb_io_unihdr("hdr_comment ", &usr->hdr_comment, ps, depth)) /* unknown string */ return False; if(!smb_io_unihdr("hdr_munged_dial ", &usr->hdr_munged_dial, ps, depth)) /* wkstas user can log on from */ return False; @@ -6438,25 +6438,25 @@ static BOOL sam_io_user_info21(const char *desc, SAM_USER_INFO_21 * usr, /* here begins pointed-to data */ - if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) /* username unicode string */ + if(!smb_io_unistr2("uni_user_name ", &usr->uni_user_name,usr->hdr_user_name.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) /* user's full name unicode string */ + if(!smb_io_unistr2("uni_full_name ", &usr->uni_full_name, usr->hdr_full_name.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) /* home directory unicode string */ + if(!smb_io_unistr2("uni_home_dir ", &usr->uni_home_dir, usr->hdr_home_dir.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) /* home directory drive unicode string */ + if(!smb_io_unistr2("uni_dir_drive ", &usr->uni_dir_drive, usr->hdr_dir_drive.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) /* logon script unicode string */ + if(!smb_io_unistr2("uni_logon_script", &usr->uni_logon_script, usr->hdr_logon_script.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) /* profile path unicode string */ + if(!smb_io_unistr2("uni_profile_path", &usr->uni_profile_path, usr->hdr_profile_path.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) /* user desc unicode string */ + if(!smb_io_unistr2("uni_acct_desc ", &usr->uni_acct_desc, usr->hdr_acct_desc.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) /* worksations user can log on from */ + if(!smb_io_unistr2("uni_workstations", &usr->uni_workstations, usr->hdr_workstations.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_unknown_str ", &usr->uni_unknown_str, usr->hdr_unknown_str.buffer, ps, depth)) /* unknown string */ + if(!smb_io_unistr2("uni_comment", &usr->uni_comment, usr->hdr_comment.buffer, ps, depth)) return False; - if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) /* worksations user can log on from */ + if(!smb_io_unistr2("uni_munged_dial ", &usr->uni_munged_dial,usr->hdr_munged_dial.buffer, ps, depth)) return False; /* ok, this is only guess-work (as usual) */ diff --git a/source3/rpc_parse/parse_shutdown.c b/source3/rpc_parse/parse_shutdown.c index da33807733..8c417c05dc 100644 --- a/source3/rpc_parse/parse_shutdown.c +++ b/source3/rpc_parse/parse_shutdown.c @@ -100,12 +100,12 @@ BOOL shutdown_io_q_init(const char *desc, SHUTDOWN_Q_INIT *q_s, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -159,12 +159,12 @@ BOOL shutdown_io_q_init_ex(const char *desc, SHUTDOWN_Q_INIT_EX * q_s, prs_struc if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; - if (!prs_pointer("message", ps, depth, (void**)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) + if (!prs_pointer("message", ps, depth, (void*)&q_s->message, sizeof(UNISTR4), (PRS_POINTER_CAST)prs_unistr4)) return False; if (!prs_align(ps)) @@ -238,7 +238,7 @@ BOOL shutdown_io_q_abort(const char *desc, SHUTDOWN_Q_ABORT *q_s, if (!prs_align(ps)) return False; - if (!prs_pointer("server", ps, depth, (void**)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) + if (!prs_pointer("server", ps, depth, (void*)&q_s->server, sizeof(uint16), (PRS_POINTER_CAST)prs_uint16)) return False; if (!prs_align(ps)) return False; diff --git a/source3/rpc_parse/parse_spoolss.c b/source3/rpc_parse/parse_spoolss.c index 2884883e89..8d4a757a74 100644 --- a/source3/rpc_parse/parse_spoolss.c +++ b/source3/rpc_parse/parse_spoolss.c @@ -606,7 +606,7 @@ static BOOL spool_io_user_level(const char *desc, SPOOL_USER_CTR *q_u, prs_struc switch ( q_u->level ) { case 1: - if ( !prs_pointer( "" , ps, depth, (void**)&q_u->user.user1, + if ( !prs_pointer( "" , ps, depth, (void*)&q_u->user.user1, sizeof(SPOOL_USER_1), (PRS_POINTER_CAST)spool_io_user_level_1 )) { return False; diff --git a/source3/rpc_parse/parse_srv.c b/source3/rpc_parse/parse_srv.c index 7d15eda630..5123d1c2cc 100644 --- a/source3/rpc_parse/parse_srv.c +++ b/source3/rpc_parse/parse_srv.c @@ -7,6 +7,7 @@ * Copyright (C) Jeremy Allison 1999, * Copyright (C) Nigel Williams 2001, * Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2002. + * Copyright (C) Gerald (Jerry) Carter 2006. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1588,64 +1589,17 @@ BOOL srv_io_r_net_share_del(const char *desc, SRV_R_NET_SHARE_DEL *q_n, prs_stru Inits a SESS_INFO_0_STR structure ********************************************************************/ -void init_srv_sess_info0_str(SESS_INFO_0_STR *ss0, const char *name) +void init_srv_sess_info0( SESS_INFO_0 *ss0, const char *name ) { - DEBUG(5,("init_srv_sess_info0_str\n")); + ZERO_STRUCTP( ss0 ); - init_unistr2(&ss0->uni_name, name, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info0_str(const char *desc, SESS_INFO_0_STR *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info0_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss0->uni_name, True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* - Inits a SESS_INFO_0 structure -********************************************************************/ - -void init_srv_sess_info0(SESS_INFO_0 *ss0, const char *name) -{ - DEBUG(5,("init_srv_sess_info0: %s\n", name)); - - ss0->ptr_name = (name != NULL) ? 1 : 0; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info0(const char *desc, SESS_INFO_0 *ss0, prs_struct *ps, int depth) -{ - if (ss0 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info0"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_name", ps, depth, &ss0->ptr_name)) - return False; - - return True; + if ( name ) { + if ( (ss0->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss0->sharename, name, UNI_STR_TERMINATE ); + } } /******************************************************************* @@ -1681,13 +1635,15 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s SMB_ASSERT_ARRAY(ss0->info_0, num_entries); + /* first the pointers */ for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info0("", &ss0->info_0[i], ps, depth)) + if ( !prs_io_unistr2_p("", ps, depth, &ss0->info_0[i].sharename ) ) return False; } + /* now the strings */ for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info0_str("", &ss0->info_0_str[i], ps, depth)) + if ( !prs_io_unistr2("sharename", ps, depth, ss0->info_0[i].sharename )) return False; } @@ -1699,53 +1655,32 @@ static BOOL srv_io_srv_sess_info_0(const char *desc, SRV_SESS_INFO_0 *ss0, prs_s } /******************************************************************* - Inits a SESS_INFO_1_STR structure -********************************************************************/ - -void init_srv_sess_info1_str(SESS_INFO_1_STR *ss1, const char *name, const char *user) -{ - DEBUG(5,("init_srv_sess_info1_str\n")); - - init_unistr2(&ss1->uni_name, name, UNI_STR_TERMINATE); - init_unistr2(&ss1->uni_user, user, UNI_STR_TERMINATE); -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info1_str(const char *desc, SESS_INFO_1_STR *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info1_str"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("", &ss1->uni_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &(ss1->uni_user), True, ps, depth)) - return False; - - return True; -} - -/******************************************************************* Inits a SESS_INFO_1 structure ********************************************************************/ -void init_srv_sess_info1(SESS_INFO_1 *ss1, - const char *name, const char *user, - uint32 num_opens, uint32 open_time, uint32 idle_time, - uint32 user_flags) +void init_srv_sess_info1( SESS_INFO_1 *ss1, const char *name, const char *user, + uint32 num_opens, uint32 open_time, uint32 idle_time, + uint32 user_flags) { DEBUG(5,("init_srv_sess_info1: %s\n", name)); - ss1->ptr_name = (name != NULL) ? 1 : 0; - ss1->ptr_user = (user != NULL) ? 1 : 0; + ZERO_STRUCTP( ss1 ); + + if ( name ) { + if ( (ss1->sharename = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->sharename, name, UNI_STR_TERMINATE ); + } + + if ( user ) { + if ( (ss1->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + DEBUG(0,("init_srv_sess_info0: talloc failed!\n")); + return; + } + init_unistr2( ss1->username, user, UNI_STR_TERMINATE ); + } ss1->num_opens = num_opens; ss1->open_time = open_time; @@ -1753,37 +1688,6 @@ void init_srv_sess_info1(SESS_INFO_1 *ss1, ss1->user_flags = user_flags; } -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -static BOOL srv_io_sess_info1(const char *desc, SESS_INFO_1 *ss1, prs_struct *ps, int depth) -{ - if (ss1 == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_sess_info1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_name ", ps, depth, &ss1->ptr_name)) - return False; - if(!prs_uint32("ptr_user ", ps, depth, &ss1->ptr_user)) - return False; - - if(!prs_uint32("num_opens ", ps, depth, &ss1->num_opens)) - return False; - if(!prs_uint32("open_time ", ps, depth, &ss1->open_time)) - return False; - if(!prs_uint32("idle_time ", ps, depth, &ss1->idle_time)) - return False; - if(!prs_uint32("user_flags", ps, depth, &ss1->user_flags)) - return False; - - return True; -} /******************************************************************* Reads or writes a structure. @@ -1818,13 +1722,31 @@ static BOOL srv_io_srv_sess_info_1(const char *desc, SRV_SESS_INFO_1 *ss1, prs_s SMB_ASSERT_ARRAY(ss1->info_1, num_entries); + /* first the pointers and flags */ + for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info1("", &ss1->info_1[i], ps, depth)) + + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2_p("", ps, depth, &ss1->info_1[i].username )) + return False; + + if(!prs_uint32("num_opens ", ps, depth, &ss1->info_1[i].num_opens)) + return False; + if(!prs_uint32("open_time ", ps, depth, &ss1->info_1[i].open_time)) + return False; + if(!prs_uint32("idle_time ", ps, depth, &ss1->info_1[i].idle_time)) + return False; + if(!prs_uint32("user_flags", ps, depth, &ss1->info_1[i].user_flags)) return False; } + /* now the strings */ + for (i = 0; i < num_entries; i++) { - if(!srv_io_sess_info1_str("", &ss1->info_1_str[i], ps, depth)) + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].sharename )) + return False; + if ( !prs_io_unistr2("", ps, depth, ss1->info_1[i].username )) return False; } @@ -1884,36 +1806,12 @@ static BOOL srv_io_srv_sess_ctr(const char *desc, SRV_SESS_INFO_CTR **pp_ctr, pr } /******************************************************************* - Inits a SRV_Q_NET_SESS_ENUM structure. -********************************************************************/ - -void init_srv_q_net_sess_enum(SRV_Q_NET_SESS_ENUM *q_n, - const char *srv_name, const char *qual_name, - const char *user_name, uint32 sess_level, - SRV_SESS_INFO_CTR *ctr, uint32 preferred_len, - ENUM_HND *hnd) -{ - q_n->ctr = ctr; - - DEBUG(5,("init_q_net_sess_enum\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); - - q_n->sess_level = sess_level; - q_n->preferred_len = preferred_len; - - memcpy(&q_n->enum_hnd, hnd, sizeof(*hnd)); -} - -/******************************************************************* Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_u, prs_struct *ps, int depth) { - if (q_n == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_sess_enum"); @@ -1922,41 +1820,36 @@ BOOL srv_io_q_net_sess_enum(const char *desc, SRV_Q_NET_SESS_ENUM *q_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_uint32("sess_level", ps, depth, &q_n->sess_level)) + if(!prs_uint32("sess_level", ps, depth, &q_u->sess_level)) return False; - if (q_n->sess_level != (uint32)-1) { - if(!srv_io_srv_sess_ctr("sess_ctr", &q_n->ctr, ps, depth)) + if (q_u->sess_level != (uint32)-1) { + if(!srv_io_srv_sess_ctr("sess_ctr", &q_u->ctr, ps, depth)) return False; } - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) return False; return True; @@ -2434,22 +2327,10 @@ BOOL srv_io_r_net_conn_enum(const char *desc, SRV_R_NET_CONN_ENUM *r_n, prs_str } /******************************************************************* - Inits a FILE_INFO_3_STR structure -********************************************************************/ - -void init_srv_file_info3_str(FILE_INFO_3_STR *fi3, const char *user_name, const char *path_name) -{ - DEBUG(5,("init_srv_file_info3_str\n")); - - init_unistr2(&fi3->uni_path_name, path_name, UNI_STR_TERMINATE); - init_unistr2(&fi3->uni_user_name, user_name, UNI_STR_TERMINATE); -} - -/******************************************************************* Reads or writes a structure. ********************************************************************/ -static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_struct *ps, int depth) +static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3 *sh1, prs_struct *ps, int depth) { if (sh1 == NULL) return False; @@ -2460,10 +2341,15 @@ static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_st if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &sh1->uni_path_name, True, ps, depth)) - return False; - if(!smb_io_unistr2("", &sh1->uni_user_name, True, ps, depth)) - return False; + if ( sh1->path ) { + if(!smb_io_unistr2("", sh1->path, True, ps, depth)) + return False; + } + + if ( sh1->user ) { + if(!smb_io_unistr2("", sh1->user, True, ps, depth)) + return False; + } return True; } @@ -2472,18 +2358,26 @@ static BOOL srv_io_file_info3_str(const char *desc, FILE_INFO_3_STR *sh1, prs_st Inits a FILE_INFO_3 structure ********************************************************************/ -void init_srv_file_info3(FILE_INFO_3 *fl3, - uint32 id, uint32 perms, uint32 num_locks, - const char *path_name, const char *user_name) +void init_srv_file_info3( FILE_INFO_3 *fl3, uint32 id, uint32 perms, uint32 num_locks, + const char *user_name, const char *path_name ) { - DEBUG(5,("init_srv_file_info3: %s %s\n", path_name, user_name)); - fl3->id = id; fl3->perms = perms; fl3->num_locks = num_locks; - fl3->ptr_path_name = (path_name != NULL) ? 1 : 0; - fl3->ptr_user_name = (user_name != NULL) ? 1 : 0; + if ( path_name ) { + if ( (fl3->path = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->path, path_name, UNI_STR_TERMINATE); + } + + if ( user_name ) { + if ( (fl3->user = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_unistr2(fl3->user, user_name, UNI_STR_TERMINATE); + } + + return; } /******************************************************************* @@ -2492,6 +2386,8 @@ void init_srv_file_info3(FILE_INFO_3 *fl3, static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps, int depth) { + uint32 uni_p; + if (fl3 == NULL) return False; @@ -2507,10 +2403,24 @@ static BOOL srv_io_file_info3(const char *desc, FILE_INFO_3 *fl3, prs_struct *ps return False; if(!prs_uint32("num_locks ", ps, depth, &fl3->num_locks)) return False; - if(!prs_uint32("ptr_path_name", ps, depth, &fl3->ptr_path_name)) + + uni_p = fl3->path ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &fl3->ptr_user_name)) + if (UNMARSHALLING(ps)) { + if ( (fl3->path = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } + + uni_p = fl3->user ? 1 : 0; + if(!prs_uint32("ptr", ps, depth, &uni_p)) return False; + if (UNMARSHALLING(ps)) { + if ( (fl3->user = PRS_ALLOC_MEM( ps, UNISTR2, 1)) == NULL ) { + return False; + } + } return True; } @@ -2528,55 +2438,53 @@ static BOOL srv_io_srv_file_ctr(const char *desc, SRV_FILE_INFO_CTR *ctr, prs_st depth++; if (UNMARSHALLING(ps)) { - memset(ctr, '\0', sizeof(SRV_FILE_INFO_CTR)); + ZERO_STRUCTP(ctr); } if(!prs_align(ps)) return False; - if(!prs_uint32("switch_value", ps, depth, &ctr->switch_value)) + if(!prs_uint32("level", ps, depth, &ctr->level)) return False; - if (ctr->switch_value != 3) { - DEBUG(5,("%s File info %d level not supported\n", - tab_depth(depth), ctr->switch_value)); - } + if(!prs_uint32("ptr_file_info", ps, depth, &ctr->ptr_file_info)) return False; if(!prs_uint32("num_entries", ps, depth, &ctr->num_entries)) return False; if(!prs_uint32("ptr_entries", ps, depth, &ctr->ptr_entries)) return False; + if (ctr->ptr_entries == 0) return True; - if(!prs_uint32("num_entries2", ps, depth, - &ctr->num_entries2)) + + if(!prs_uint32("num_entries2", ps, depth, &ctr->num_entries2)) return False; - switch (ctr->switch_value) { + switch (ctr->level) { case 3: { - SRV_FILE_INFO_3 *info3 = ctr->file.info3; + FILE_INFO_3 *info3 = ctr->file.info3; int num_entries = ctr->num_entries; int i; if (UNMARSHALLING(ps)) { - if (!(info3 = PRS_ALLOC_MEM(ps, SRV_FILE_INFO_3, num_entries))) + if (!(info3 = PRS_ALLOC_MEM(ps, FILE_INFO_3, num_entries))) return False; ctr->file.info3 = info3; } for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3("", &ctr->file.info3[i].info_3, ps, depth)) + if(!srv_io_file_info3("", &ctr->file.info3[i], ps, depth)) return False; } + for (i = 0; i < num_entries; i++) { - if(!srv_io_file_info3_str("", &ctr->file.info3[i].info_3_str, ps, depth)) + if(!srv_io_file_info3_str("", &ctr->file.info3[i], ps, depth)) return False; } break; } default: - DEBUG(5,("%s no file info at switch_value %d\n", - tab_depth(depth), ctr->switch_value)); + DEBUG(5,("%s no file info at switch_value %d\n", tab_depth(depth), ctr->level)); break; } @@ -2594,13 +2502,28 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, uint32 preferred_len, ENUM_HND *hnd) { - DEBUG(5,("init_q_net_file_enum\n")); + uint32 ptr; - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_qual_name, &q_n->ptr_qual_name, qual_name); - init_buf_unistr2(&q_n->uni_user_name, &q_n->ptr_user_name, user_name); + if ( srv_name ) { + if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->servername, &ptr, srv_name); + } + + if ( qual_name ) { + if ( (q_n->qualifier = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->qualifier, &ptr, qual_name); + } + + if ( user_name ) { + if ( (q_n->username = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) + return; + init_buf_unistr2(q_n->username, &ptr, user_name); + } + + q_n->level = q_n->ctr.level = file_level; - q_n->file_level = q_n->ctr.switch_value = file_level; q_n->preferred_len = preferred_len; q_n->ctr.ptr_file_info = 1; q_n->ctr.num_entries = 0; @@ -2613,9 +2536,9 @@ void init_srv_q_net_file_enum(SRV_Q_NET_FILE_ENUM *q_n, Reads or writes a structure. ********************************************************************/ -BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_struct *ps, int depth) +BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_u, prs_struct *ps, int depth) { - if (q_n == NULL) + if (q_u == NULL) return False; prs_debug(ps, depth, desc, "srv_io_q_net_file_enum"); @@ -2624,41 +2547,33 @@ BOOL srv_io_q_net_file_enum(const char *desc, SRV_Q_NET_FILE_ENUM *q_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) + if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_qual_name", ps, depth, &q_n->ptr_qual_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_qual_name, q_n->ptr_qual_name, ps, depth)) + if(!prs_pointer("qualifier", ps, depth, (void*)&q_u->qualifier, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_user_name", ps, depth, &q_n->ptr_user_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_user_name, q_n->ptr_user_name, ps, depth)) + if(!prs_pointer("username", ps, depth, (void*)&q_u->username, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; - if(!prs_align(ps)) return False; - if(!prs_uint32("file_level", ps, depth, &q_n->file_level)) + + if(!prs_uint32("level", ps, depth, &q_u->level)) return False; - if (q_n->file_level != (uint32)-1) { - if(!srv_io_srv_file_ctr("file_ctr", &q_n->ctr, ps, depth)) + if (q_u->level != (uint32)-1) { + if(!srv_io_srv_file_ctr("file_ctr", &q_u->ctr, ps, depth)) return False; } - if(!prs_uint32("preferred_len", ps, depth, &q_n->preferred_len)) + if(!prs_uint32("preferred_len", ps, depth, &q_u->preferred_len)) return False; - if(!smb_io_enum_hnd("enum_hnd", &q_n->enum_hnd, ps, depth)) + if(!smb_io_enum_hnd("enum_hnd", &q_u->enum_hnd, ps, depth)) return False; return True; @@ -2679,10 +2594,10 @@ BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru if(!prs_align(ps)) return False; - if(!prs_uint32("file_level", ps, depth, &r_n->file_level)) + if(!prs_uint32("level", ps, depth, &r_n->level)) return False; - if (r_n->file_level != 0) { + if (r_n->level != 0) { if(!srv_io_srv_file_ctr("file_ctr", &r_n->ctr, ps, depth)) return False; } @@ -2703,63 +2618,17 @@ BOOL srv_io_r_net_file_enum(const char *desc, SRV_R_NET_FILE_ENUM *r_n, prs_stru void init_srv_q_net_file_close(SRV_Q_NET_FILE_CLOSE *q_n, const char *server, uint32 file_id) { - q_n->ptr_srv_name = 1; - init_unistr2(&q_n->uni_srv_name, server, UNI_STR_TERMINATE); - q_n->file_id = file_id; -} - -/******************************************************************* - Reads or writes a structure. -********************************************************************/ -BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_n, - prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) - return False; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("file_id", ps, depth, &q_n->file_id)) - return False; + if ( server ) { + if ( (q_n->servername = TALLOC_P( get_talloc_ctx(), UNISTR2 )) == NULL ) { + return; + } + init_unistr2(q_n->servername, server, UNI_STR_TERMINATE); + } - return True; + q_n->file_id = file_id; } /******************************************************************* - Reads or writes a structure. -********************************************************************/ - -BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *q_n, - prs_struct *ps, int depth) -{ - if (q_n == NULL) - return False; - - prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_werror("status", ps, depth, &q_n->status)) - return False; - - return True; -} - -/******************************************************************* Inits a SRV_INFO_100 structure. ********************************************************************/ @@ -3411,25 +3280,6 @@ BOOL srv_io_r_net_disk_enum(const char *desc, SRV_R_NET_DISK_ENUM *r_n, prs_stru } /******************************************************************* - initialises a structure. - ********************************************************************/ - -BOOL init_srv_q_net_name_validate(SRV_Q_NET_NAME_VALIDATE *q_n, const char *srv_name, const char *share_name, int type) -{ - uint32 ptr_share_name; - - DEBUG(5,("init_srv_q_net_name_validate\n")); - - init_buf_unistr2(&q_n->uni_srv_name, &q_n->ptr_srv_name, srv_name); - init_buf_unistr2(&q_n->uni_name, &ptr_share_name, share_name); - - q_n->type = type; - q_n->flags = 0; - - return True; -} - -/******************************************************************* Reads or writes a structure. ********************************************************************/ @@ -3444,16 +3294,13 @@ BOOL srv_io_q_net_name_validate(const char *desc, SRV_Q_NET_NAME_VALIDATE *q_n, if(!prs_align(ps)) return False; - if(!prs_uint32("ptr_srv_name", ps, depth, &q_n->ptr_srv_name)) - return False; - - if(!smb_io_unistr2("", &q_n->uni_srv_name, True, ps, depth)) + if(!prs_pointer("servername", ps, depth, (void*)&q_n->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!smb_io_unistr2("", &q_n->uni_name, True, ps, depth)) + if(!smb_io_unistr2("", &q_n->sharename, True, ps, depth)) return False; if(!prs_align(ps)) @@ -3663,3 +3510,48 @@ void init_srv_q_net_remote_tod(SRV_Q_NET_REMOTE_TOD *q_u, const char *server) q_u->ptr_srv_name = 1; init_unistr2(&q_u->uni_srv_name, server, UNI_STR_TERMINATE); } + + +/******************************************************************* + Reads or writes a structure. +********************************************************************/ + +BOOL srv_io_q_net_file_close(const char *desc, SRV_Q_NET_FILE_CLOSE *q_u, prs_struct *ps, int depth) +{ + if (q_u == NULL) + return False; + + prs_debug(ps, depth, desc, "srv_io_q_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + return False; + if(!prs_align(ps)) + return False; + + if(!prs_uint32("file_id", ps, depth, &q_u->file_id)) + return False; + + return True; +} + +/******************************************************************* + ********************************************************************/ + +BOOL srv_io_r_net_file_close(const char *desc, SRV_R_NET_FILE_CLOSE *r_n, + prs_struct *ps, int depth) +{ + prs_debug(ps, depth, desc, "srv_io_r_net_file_close"); + depth++; + + if(!prs_align(ps)) + return False; + + if(!prs_werror("status", ps, depth, &r_n->status)) + return False; + + return True; +} diff --git a/source3/rpc_parse/parse_svcctl.c b/source3/rpc_parse/parse_svcctl.c index 2cb44c6319..dc4ee3e6e9 100644 --- a/source3/rpc_parse/parse_svcctl.c +++ b/source3/rpc_parse/parse_svcctl.c @@ -257,12 +257,12 @@ BOOL svcctl_io_q_open_scmanager(const char *desc, SVCCTL_Q_OPEN_SCMANAGER *q_u, if(!prs_align(ps)) return False; - if(!prs_pointer("servername", ps, depth, (void**)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + if(!prs_pointer("servername", ps, depth, (void*)&q_u->servername, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; - if(!prs_pointer("database", ps, depth, (void**)&q_u->database, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) + if(!prs_pointer("database", ps, depth, (void*)&q_u->database, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2)) return False; if(!prs_align(ps)) return False; @@ -486,7 +486,7 @@ BOOL svcctl_io_q_enum_services_status(const char *desc, SVCCTL_Q_ENUM_SERVICES_S if(!prs_uint32("buffer_size", ps, depth, &q_u->buffer_size)) return False; - if(!prs_pointer("resume", ps, depth, (void**)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("resume", ps, depth, (void*)&q_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; return True; @@ -517,7 +517,7 @@ BOOL svcctl_io_r_enum_services_status(const char *desc, SVCCTL_R_ENUM_SERVICES_S if(!prs_uint32("returned", ps, depth, &r_u->returned)) return False; - if(!prs_pointer("resume", ps, depth, (void**)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) + if(!prs_pointer("resume", ps, depth, (void*)&r_u->resume, sizeof(uint32), (PRS_POINTER_CAST)prs_uint32)) return False; if(!prs_werror("status", ps, depth, &r_u->status)) @@ -546,7 +546,7 @@ BOOL svcctl_io_q_start_service(const char *desc, SVCCTL_Q_START_SERVICE *q_u, pr if(!prs_uint32("parmcount", ps, depth, &q_u->parmcount)) return False; - if ( !prs_pointer("rights", ps, depth, (void**)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) + if ( !prs_pointer("rights", ps, depth, (void*)&q_u->parameters, sizeof(UNISTR4_ARRAY), (PRS_POINTER_CAST)prs_unistr4_array) ) return False; return True; @@ -821,9 +821,9 @@ BOOL svcctl_io_service_fa( const char *desc, SERVICE_FAILURE_ACTIONS *fa, RPC_BU if ( !prs_uint32("reset_period", ps, depth, &fa->reset_period) ) return False; - if ( !prs_pointer( desc, ps, depth, (void**)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + if ( !prs_pointer( desc, ps, depth, (void*)&fa->rebootmsg, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; - if ( !prs_pointer( desc, ps, depth, (void**)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) + if ( !prs_pointer( desc, ps, depth, (void*)&fa->command, sizeof(UNISTR2), (PRS_POINTER_CAST)prs_io_unistr2 ) ) return False; if ( !prs_uint32("num_actions", ps, depth, &fa->num_actions) ) diff --git a/source3/rpc_parse/parse_unixinfo.c b/source3/rpc_parse/parse_unixinfo.c new file mode 100644 index 0000000000..391713ce90 --- /dev/null +++ b/source3/rpc_parse/parse_unixinfo.c @@ -0,0 +1,266 @@ +/* + * Unix SMB/CIFS implementation. + * + * RPC Pipe client / server routines + * + * Copyright (C) Volker Lendecke 2005 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "includes.h" + +#undef DBGC_CLASS +#define DBGC_CLASS DBGC_RPC_PARSE + +void init_q_unixinfo_sid_to_uid(UNIXINFO_Q_SID_TO_UID *q_d, const DOM_SID *sid) +{ + sid_copy(&q_d->sid, sid); +} + +BOOL unixinfo_io_q_unixinfo_sid_to_uid(const char *desc, UNIXINFO_Q_SID_TO_UID *q_d, + prs_struct *ps, int depth) +{ + return smb_io_dom_sid(desc, &q_d->sid, ps, depth); +} + +BOOL unixinfo_io_r_unixinfo_sid_to_uid(const char *desc, UNIXINFO_R_SID_TO_UID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint64(desc, ps, depth, &r_d->uid)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_uid_to_sid(UNIXINFO_Q_UID_TO_SID *q_d, UINT64_S uid) +{ + q_d->uid = uid; +} + +BOOL unixinfo_io_q_unixinfo_uid_to_sid(const char *desc, UNIXINFO_Q_UID_TO_SID *q_d, + prs_struct *ps, int depth) +{ + return prs_uint64(desc, ps, depth, &q_d->uid); +} + +void init_r_unixinfo_uid_to_sid(UNIXINFO_R_UID_TO_SID *r_d, DOM_SID *sid) +{ + if (sid == NULL) { + r_d->sidptr = 0; + return; + } + r_d->sidptr = 1; + sid_copy(&r_d->sid, sid); +} + +BOOL unixinfo_io_r_unixinfo_uid_to_sid(const char *desc, UNIXINFO_R_UID_TO_SID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) + return False; + + if (r_d->sidptr != 0) { + if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) + return False; + } + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_sid_to_gid(UNIXINFO_Q_SID_TO_GID *q_d, const DOM_SID *sid) +{ + sid_copy(&q_d->sid, sid); +} + +BOOL unixinfo_io_q_unixinfo_sid_to_gid(const char *desc, UNIXINFO_Q_SID_TO_GID *q_d, + prs_struct *ps, int depth) +{ + return smb_io_dom_sid(desc, &q_d->sid, ps, depth); +} + +void init_r_unixinfo_sid_to_gid(UNIXINFO_R_SID_TO_GID *r_d, UINT64_S gid) +{ + r_d->gid = gid; + r_d->status = NT_STATUS_OK; +} + +BOOL unixinfo_io_r_unixinfo_sid_to_gid(const char *desc, UNIXINFO_R_SID_TO_GID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint64(desc, ps, depth, &r_d->gid)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_gid_to_sid(UNIXINFO_Q_GID_TO_SID *q_d, UINT64_S gid) +{ + q_d->gid = gid; +} + +BOOL unixinfo_io_q_unixinfo_gid_to_sid(const char *desc, UNIXINFO_Q_GID_TO_SID *q_d, + prs_struct *ps, int depth) +{ + return prs_uint64(desc, ps, depth, &q_d->gid); +} + +void init_r_unixinfo_gid_to_sid(UNIXINFO_R_GID_TO_SID *r_d, DOM_SID *sid) +{ + if (sid == NULL) { + r_d->sidptr = 0; + return; + } + r_d->sidptr = 1; + sid_copy(&r_d->sid, sid); +} + +BOOL unixinfo_io_r_unixinfo_gid_to_sid(const char *desc, UNIXINFO_R_GID_TO_SID *r_d, + prs_struct *ps, int depth) +{ + if (!prs_uint32("sidptr", ps, depth, &r_d->sidptr)) + return False; + + if (r_d->sidptr != 0) { + if (!smb_io_dom_sid(desc, &r_d->sid, ps, depth)) + return False; + } + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} + +void init_q_unixinfo_getpwuid(UNIXINFO_Q_GETPWUID *r_d, int count, + UINT64_S *uids) +{ + r_d->count = count; + r_d->uid = uids; +} + +BOOL unixinfo_io_q_unixinfo_getpwuid(const char *desc, + UNIXINFO_Q_GETPWUID *q_d, + prs_struct *ps, int depth) +{ + uint32 arraysize; + int i; + + if (!prs_uint32("count", ps, depth, &q_d->count)) + return False; + + arraysize = q_d->count; + + if (!prs_uint32("arraysize", ps, depth, &arraysize)) + return False; + + if (arraysize != q_d->count) { + DEBUG(10, ("count!=arraysize\n")); + return False; + } + + if (q_d->count > 1023) { + DEBUG(10, ("Range exceeded\n")); + return False; + } + + if (UNMARSHALLING(ps)) { + q_d->uid = PRS_ALLOC_MEM(ps, UINT64_S, q_d->count); + if (q_d->uid == NULL) { + return False; + } + } + + for (i=0; i<q_d->count; i++) { + if (!prs_uint64(desc, ps, depth+1, &q_d->uid[i])) + return False; + } + + return True; +} + +void init_r_unixinfo_getpwuid(UNIXINFO_R_GETPWUID *r_d, uint32 count, + struct unixinfo_getpwuid *info) +{ + r_d->count = count; + r_d->info = info; +} + +BOOL unixinfo_io_r_unixinfo_getpwuid(const char *desc, + UNIXINFO_R_GETPWUID *r_d, + prs_struct *ps, int depth) +{ + uint32 arraysize; + int i; + + if (!prs_uint32("count", ps, depth, &r_d->count)) + return False; + + arraysize = r_d->count; + + if (!prs_uint32("arraysize", ps, depth, &arraysize)) + return False; + + if (arraysize != r_d->count) { + DEBUG(10, ("count!=arraysize\n")); + return False; + } + + if (r_d->count > 1023) { + DEBUG(10, ("Range exceeded\n")); + return False; + } + + if (UNMARSHALLING(ps)) { + r_d->info = PRS_ALLOC_MEM(ps, struct unixinfo_getpwuid, + r_d->count); + if (r_d->info == NULL) { + return False; + } + } + + for (i=0; i<r_d->count; i++) { + if (!prs_align(ps)) + return False; + + if (!prs_ntstatus("status", ps, depth+1, &r_d->info[i].status)) + return False; + + if (!prs_string_alloc("homedir", ps, depth+1, + &r_d->info[i].homedir)) + return False; + + if (!prs_string_alloc("shell", ps, depth+1, + &r_d->info[i].shell)) + return False; + } + + if (!prs_align(ps)) + return False; + + if (!prs_ntstatus(desc, ps, depth, &r_d->status)) + return False; + + return True; +} |