diff options
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r-- | source3/rpc_parse/parse_samr.c | 702 |
1 files changed, 0 insertions, 702 deletions
diff --git a/source3/rpc_parse/parse_samr.c b/source3/rpc_parse/parse_samr.c index 5b4d981412..09804f1466 100644 --- a/source3/rpc_parse/parse_samr.c +++ b/source3/rpc_parse/parse_samr.c @@ -181,312 +181,6 @@ void init_samr_DomInfo12(struct samr_DomInfo12 *r, } /******************************************************************* -reads or writes a SAM_STR1 structure. -********************************************************************/ - -static bool sam_io_sam_str1(const char *desc, SAM_STR1 * sam, uint32 acct_buf, - uint32 name_buf, uint32 desc_buf, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_str1"); - depth++; - - if(!prs_align(ps)) - return False; - if (!smb_io_unistr2("name", &sam->uni_acct_name, acct_buf, ps, depth)) - return False; - - if (!smb_io_unistr2("desc", &sam->uni_acct_desc, desc_buf, ps, depth)) - return False; - - if (!smb_io_unistr2("full", &sam->uni_full_name, name_buf, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAM_ENTRY1 structure. -********************************************************************/ - -static void init_sam_entry1(SAM_ENTRY1 *sam, uint32 user_idx, - UNISTR2 *sam_name, UNISTR2 *sam_full, - UNISTR2 *sam_desc, uint32 rid_user, - uint32 acb_info) -{ - DEBUG(5, ("init_sam_entry1\n")); - - ZERO_STRUCTP(sam); - - sam->user_idx = user_idx; - sam->rid_user = rid_user; - sam->acb_info = acb_info; - - init_uni_hdr(&sam->hdr_acct_name, sam_name); - init_uni_hdr(&sam->hdr_user_name, sam_full); - init_uni_hdr(&sam->hdr_user_desc, sam_desc); -} - -/******************************************************************* -reads or writes a SAM_ENTRY1 structure. -********************************************************************/ - -static bool sam_io_sam_entry1(const char *desc, SAM_ENTRY1 * sam, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_entry1"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx)) - return False; - - if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) - return False; - if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info)) - return False; - - if (!smb_io_unihdr("hdr_acct_name", &sam->hdr_acct_name, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_user_desc", &sam->hdr_user_desc, ps, depth)) - return False; - if (!smb_io_unihdr("hdr_user_name", &sam->hdr_user_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -reads or writes a SAM_STR2 structure. -********************************************************************/ - -static bool sam_io_sam_str2(const char *desc, SAM_STR2 * sam, uint32 acct_buf, - uint32 desc_buf, prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_str2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("uni_srv_name", &sam->uni_srv_name, acct_buf, ps, depth)) /* account name unicode string */ - return False; - if(!smb_io_unistr2("uni_srv_desc", &sam->uni_srv_desc, desc_buf, ps, depth)) /* account desc unicode string */ - return False; - - return True; -} - -/******************************************************************* -inits a SAM_ENTRY2 structure. -********************************************************************/ -static void init_sam_entry2(SAM_ENTRY2 * sam, uint32 user_idx, - UNISTR2 *sam_name, UNISTR2 *sam_desc, - uint32 rid_user, uint32 acb_info) -{ - DEBUG(5, ("init_sam_entry2\n")); - - sam->user_idx = user_idx; - sam->rid_user = rid_user; - sam->acb_info = acb_info; - - init_uni_hdr(&sam->hdr_srv_name, sam_name); - init_uni_hdr(&sam->hdr_srv_desc, sam_desc); -} - -/******************************************************************* -reads or writes a SAM_ENTRY2 structure. -********************************************************************/ - -static bool sam_io_sam_entry2(const char *desc, SAM_ENTRY2 * sam, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_entry2"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("user_idx ", ps, depth, &sam->user_idx)) - return False; - - if(!prs_uint32("rid_user ", ps, depth, &sam->rid_user)) - return False; - if(!prs_uint32("acb_info ", ps, depth, &sam->acb_info)) - return False; - - if(!smb_io_unihdr("unihdr", &sam->hdr_srv_name, ps, depth)) /* account name unicode string header */ - return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_srv_desc, ps, depth)) /* account name unicode string header */ - return False; - - return True; -} - -/******************************************************************* -reads or writes a SAM_STR3 structure. -********************************************************************/ - -static bool sam_io_sam_str3(const char *desc, SAM_STR3 * sam, uint32 acct_buf, - uint32 desc_buf, prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_str3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_unistr2("uni_grp_name", &sam->uni_grp_name, acct_buf, ps, depth)) /* account name unicode string */ - return False; - if(!smb_io_unistr2("uni_grp_desc", &sam->uni_grp_desc, desc_buf, ps, depth)) /* account desc unicode string */ - return False; - - return True; -} - -/******************************************************************* -inits a SAM_ENTRY3 structure. -********************************************************************/ - -static void init_sam_entry3(SAM_ENTRY3 * sam, uint32 grp_idx, - UNISTR2 *grp_name, UNISTR2 *grp_desc, - uint32 rid_grp) -{ - DEBUG(5, ("init_sam_entry3\n")); - - sam->grp_idx = grp_idx; - sam->rid_grp = rid_grp; - sam->attr = 0x07; /* group rid attributes - gets ignored by nt 4.0 */ - - init_uni_hdr(&sam->hdr_grp_name, grp_name); - init_uni_hdr(&sam->hdr_grp_desc, grp_desc); -} - -/******************************************************************* -reads or writes a SAM_ENTRY3 structure. -********************************************************************/ - -static bool sam_io_sam_entry3(const char *desc, SAM_ENTRY3 * sam, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_entry3"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx)) - return False; - - if(!prs_uint32("rid_grp", ps, depth, &sam->rid_grp)) - return False; - if(!prs_uint32("attr ", ps, depth, &sam->attr)) - return False; - - if(!smb_io_unihdr("unihdr", &sam->hdr_grp_name, ps, depth)) /* account name unicode string header */ - return False; - if(!smb_io_unihdr("unihdr", &sam->hdr_grp_desc, ps, depth)) /* account name unicode string header */ - return False; - - return True; -} - -/******************************************************************* -inits a SAM_ENTRY4 structure. -********************************************************************/ - -static void init_sam_entry4(SAM_ENTRY4 * sam, uint32 user_idx, - uint32 len_acct_name) -{ - DEBUG(5, ("init_sam_entry4\n")); - - sam->user_idx = user_idx; - init_str_hdr(&sam->hdr_acct_name, len_acct_name+1, len_acct_name, len_acct_name != 0); -} - -/******************************************************************* -reads or writes a SAM_ENTRY4 structure. -********************************************************************/ - -static bool sam_io_sam_entry4(const char *desc, SAM_ENTRY4 * sam, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_entry4"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("user_idx", ps, depth, &sam->user_idx)) - return False; - if(!smb_io_strhdr("strhdr", &sam->hdr_acct_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* -inits a SAM_ENTRY5 structure. -********************************************************************/ - -static void init_sam_entry5(SAM_ENTRY5 * sam, uint32 grp_idx, - uint32 len_grp_name) -{ - DEBUG(5, ("init_sam_entry5\n")); - - sam->grp_idx = grp_idx; - init_str_hdr(&sam->hdr_grp_name, len_grp_name, len_grp_name, - len_grp_name != 0); -} - -/******************************************************************* -reads or writes a SAM_ENTRY5 structure. -********************************************************************/ - -static bool sam_io_sam_entry5(const char *desc, SAM_ENTRY5 * sam, - prs_struct *ps, int depth) -{ - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_entry5"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("grp_idx", ps, depth, &sam->grp_idx)) - return False; - if(!smb_io_strhdr("strhdr", &sam->hdr_grp_name, ps, depth)) - return False; - - return True; -} - -/******************************************************************* inits a SAM_ENTRY structure. ********************************************************************/ @@ -661,59 +355,6 @@ bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, } /******************************************************************* -inits a SAMR_Q_QUERY_DISPINFO structure. -********************************************************************/ - -void init_samr_q_query_dispinfo(SAMR_Q_QUERY_DISPINFO * q_e, POLICY_HND *pol, - uint16 switch_level, uint32 start_idx, - uint32 max_entries, uint32 max_size) -{ - DEBUG(5, ("init_samr_q_query_dispinfo\n")); - - q_e->domain_pol = *pol; - - q_e->switch_level = switch_level; - - q_e->start_idx = start_idx; - q_e->max_entries = max_entries; - q_e->max_size = max_size; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_q_query_dispinfo(const char *desc, SAMR_Q_QUERY_DISPINFO * q_e, - prs_struct *ps, int depth) -{ - if (q_e == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_q_query_dispinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!smb_io_pol_hnd("domain_pol", &q_e->domain_pol, ps, depth)) - return False; - - if(!prs_uint16("switch_level", ps, depth, &q_e->switch_level)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("start_idx ", ps, depth, &q_e->start_idx)) - return False; - if(!prs_uint32("max_entries ", ps, depth, &q_e->max_entries)) - return False; - if(!prs_uint32("max_size ", ps, depth, &q_e->max_size)) - return False; - - return True; -} - -/******************************************************************* inits a samr_DispInfoGeneral structure. ********************************************************************/ @@ -758,51 +399,6 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, } /******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_sam_dispinfo_1(const char *desc, SAM_DISPINFO_1 * sam, - uint32 num_entries, - prs_struct *ps, int depth) -{ - uint32 i; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_1"); - depth++; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps) && num_entries > 0) { - - if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY1, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_ENTRY1\n")); - return False; - } - - if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR1, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_STR1\n")); - return False; - } - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_entry1("", &sam->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_str1("", &sam->str[i], - sam->sam[i].hdr_acct_name.buffer, - sam->sam[i].hdr_user_name.buffer, - sam->sam[i].hdr_user_desc.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* inits a samr_DispInfoFull structure. ********************************************************************/ @@ -844,53 +440,6 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, } /******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_sam_dispinfo_2(const char *desc, SAM_DISPINFO_2 * sam, - uint32 num_entries, - prs_struct *ps, int depth) -{ - uint32 i; - - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_2"); - depth++; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps) && num_entries > 0) { - - if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY2, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_ENTRY2\n")); - return False; - } - - if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR2, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_STR2\n")); - return False; - } - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_entry2("", &sam->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_str2("", &sam->str[i], - sam->sam[i].hdr_srv_name.buffer, - sam->sam[i].hdr_srv_desc.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* inits a samr_DispInfoFullGroups structure. ********************************************************************/ @@ -932,53 +481,6 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, } /******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_sam_dispinfo_3(const char *desc, SAM_DISPINFO_3 * sam, - uint32 num_entries, - prs_struct *ps, int depth) -{ - uint32 i; - - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_3"); - depth++; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps) && num_entries > 0) { - - if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY3, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_ENTRY3\n")); - return False; - } - - if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR3, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_STR3\n")); - return False; - } - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_entry3("", &sam->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_str3("", &sam->str[i], - sam->sam[i].hdr_grp_name.buffer, - sam->sam[i].hdr_grp_desc.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* inits a samr_DispInfoAscii structure. ********************************************************************/ @@ -1015,52 +517,6 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, } /******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_sam_dispinfo_4(const char *desc, SAM_DISPINFO_4 * sam, - uint32 num_entries, - prs_struct *ps, int depth) -{ - uint32 i; - - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_4"); - depth++; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps) && num_entries > 0) { - - if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY4, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_ENTRY4\n")); - return False; - } - - if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR4, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_STR4\n")); - return False; - } - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_entry4("", &sam->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!smb_io_string2("acct_name", &sam->str[i].acct_name, - sam->sam[i].hdr_acct_name.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* inits a samr_DispInfoAscii structure. ********************************************************************/ @@ -1097,164 +553,6 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, } /******************************************************************* -reads or writes a structure. -********************************************************************/ - -static bool sam_io_sam_dispinfo_5(const char *desc, SAM_DISPINFO_5 * sam, - uint32 num_entries, - prs_struct *ps, int depth) -{ - uint32 i; - - if (sam == NULL) - return False; - - prs_debug(ps, depth, desc, "sam_io_sam_dispinfo_5"); - depth++; - - if(!prs_align(ps)) - return False; - - if (UNMARSHALLING(ps) && num_entries > 0) { - - if ((sam->sam = PRS_ALLOC_MEM(ps, SAM_ENTRY5, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_ENTRY5\n")); - return False; - } - - if ((sam->str = PRS_ALLOC_MEM(ps, SAM_STR5, num_entries)) == NULL) { - DEBUG(0, ("out of memory allocating SAM_STR5\n")); - return False; - } - } - - for (i = 0; i < num_entries; i++) { - if(!sam_io_sam_entry5("", &sam->sam[i], ps, depth)) - return False; - } - - for (i = 0; i < num_entries; i++) { - if(!smb_io_string2("grp_name", &sam->str[i].grp_name, - sam->sam[i].hdr_grp_name.buffer, ps, depth)) - return False; - } - - return True; -} - -/******************************************************************* -inits a SAMR_R_QUERY_DISPINFO structure. -********************************************************************/ - -void init_samr_r_query_dispinfo(SAMR_R_QUERY_DISPINFO * r_u, - uint32 num_entries, uint32 total_size, uint32 data_size, - uint16 switch_level, SAM_DISPINFO_CTR * ctr, - NTSTATUS status) -{ - DEBUG(5, ("init_samr_r_query_dispinfo: level %d\n", switch_level)); - - r_u->total_size = total_size; - - r_u->data_size = data_size; - - r_u->switch_level = switch_level; - r_u->num_entries = num_entries; - - if (num_entries==0) - r_u->ptr_entries = 0; - else - r_u->ptr_entries = 1; - - r_u->num_entries2 = num_entries; - r_u->ctr = ctr; - - r_u->status = status; -} - -/******************************************************************* -reads or writes a structure. -********************************************************************/ - -bool samr_io_r_query_dispinfo(const char *desc, SAMR_R_QUERY_DISPINFO * r_u, - prs_struct *ps, int depth) -{ - if (r_u == NULL) - return False; - - prs_debug(ps, depth, desc, "samr_io_r_query_dispinfo"); - depth++; - - if(!prs_align(ps)) - return False; - - if(!prs_uint32("total_size ", ps, depth, &r_u->total_size)) - return False; - if(!prs_uint32("data_size ", ps, depth, &r_u->data_size)) - return False; - if(!prs_uint16("switch_level", ps, depth, &r_u->switch_level)) - return False; - if(!prs_align(ps)) - return False; - - if(!prs_uint32("num_entries ", ps, depth, &r_u->num_entries)) - return False; - if(!prs_uint32("ptr_entries ", ps, depth, &r_u->ptr_entries)) - return False; - - if (r_u->ptr_entries==0) { - if(!prs_align(ps)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; - } - - if(!prs_uint32("num_entries2", ps, depth, &r_u->num_entries2)) - return False; - - switch (r_u->switch_level) { - case 0x1: - if(!sam_io_sam_dispinfo_1("users", r_u->ctr->sam.info1, - r_u->num_entries, ps, depth)) - return False; - break; - case 0x2: - if(!sam_io_sam_dispinfo_2("servers", r_u->ctr->sam.info2, - r_u->num_entries, ps, depth)) - return False; - break; - case 0x3: - if(!sam_io_sam_dispinfo_3("groups", r_u->ctr->sam.info3, - r_u->num_entries, ps, depth)) - return False; - break; - case 0x4: - if(!sam_io_sam_dispinfo_4("user list", - r_u->ctr->sam.info4, - r_u->num_entries, ps, depth)) - return False; - break; - case 0x5: - if(!sam_io_sam_dispinfo_5("group list", - r_u->ctr->sam.info5, - r_u->num_entries, ps, depth)) - return False; - break; - default: - DEBUG(0,("samr_io_r_query_dispinfo: unknown switch value\n")); - break; - } - - if(!prs_align(ps)) - return False; - if(!prs_ntstatus("status", ps, depth, &r_u->status)) - return False; - - return True; -} - -/******************************************************************* inits a samr_GroupInfoAll structure. ********************************************************************/ |