From e1af5066d528895e65eae95403b029b65cc6febc Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 7 Feb 2008 20:47:21 +0100 Subject: Remove unused marshalling for SAMR_QUERY_DISPINFO. Guenther (This used to be commit c09e619a58e8a8a5317627acbf05d8b08ffdf9f4) --- source3/include/rpc_samr.h | 188 ----------- source3/rpc_client/cli_samr.c | 51 --- source3/rpc_parse/parse_samr.c | 702 ----------------------------------------- source3/utils/net_rpc.c | 2 - 4 files changed, 943 deletions(-) (limited to 'source3') diff --git a/source3/include/rpc_samr.h b/source3/include/rpc_samr.h index 5919bc7910..086f61e8c6 100644 --- a/source3/include/rpc_samr.h +++ b/source3/include/rpc_samr.h @@ -590,194 +590,6 @@ typedef struct r_samr_enum_dom_aliases_info } SAMR_R_ENUM_DOM_ALIASES; -/* -- Level 1 Display Info - User Information -- */ - -typedef struct samr_entry_info1 -{ - uint32 user_idx; - - uint32 rid_user; - uint32 acb_info; - - UNIHDR hdr_acct_name; - UNIHDR hdr_user_name; - UNIHDR hdr_user_desc; - -} SAM_ENTRY1; - -typedef struct samr_str_entry_info1 -{ - UNISTR2 uni_acct_name; - UNISTR2 uni_full_name; - UNISTR2 uni_acct_desc; - -} SAM_STR1; - -typedef struct sam_entry_info_1 -{ - SAM_ENTRY1 *sam; - SAM_STR1 *str; - -} SAM_DISPINFO_1; - - -/* -- Level 2 Display Info - Trust Account Information -- */ - -typedef struct samr_entry_info2 -{ - uint32 user_idx; - - uint32 rid_user; - uint32 acb_info; - - UNIHDR hdr_srv_name; - UNIHDR hdr_srv_desc; - -} SAM_ENTRY2; - -typedef struct samr_str_entry_info2 -{ - UNISTR2 uni_srv_name; - UNISTR2 uni_srv_desc; - -} SAM_STR2; - -typedef struct sam_entry_info_2 -{ - SAM_ENTRY2 *sam; - SAM_STR2 *str; - -} SAM_DISPINFO_2; - - -/* -- Level 3 Display Info - Domain Group Information -- */ - -typedef struct samr_entry_info3 -{ - uint32 grp_idx; - - uint32 rid_grp; - uint32 attr; /* SE_GROUP_xxx, usually 7 */ - - UNIHDR hdr_grp_name; - UNIHDR hdr_grp_desc; - -} SAM_ENTRY3; - -typedef struct samr_str_entry_info3 -{ - UNISTR2 uni_grp_name; - UNISTR2 uni_grp_desc; - -} SAM_STR3; - -typedef struct sam_entry_info_3 -{ - SAM_ENTRY3 *sam; - SAM_STR3 *str; - -} SAM_DISPINFO_3; - - -/* -- Level 4 Display Info - User List (ASCII) -- */ - -typedef struct samr_entry_info4 -{ - uint32 user_idx; - STRHDR hdr_acct_name; - -} SAM_ENTRY4; - -typedef struct samr_str_entry_info4 -{ - STRING2 acct_name; - -} SAM_STR4; - -typedef struct sam_entry_info_4 -{ - SAM_ENTRY4 *sam; - SAM_STR4 *str; - -} SAM_DISPINFO_4; - - -/* -- Level 5 Display Info - Group List (ASCII) -- */ - -typedef struct samr_entry_info5 -{ - uint32 grp_idx; - STRHDR hdr_grp_name; - -} SAM_ENTRY5; - -typedef struct samr_str_entry_info5 -{ - STRING2 grp_name; - -} SAM_STR5; - -typedef struct sam_entry_info_5 -{ - SAM_ENTRY5 *sam; - SAM_STR5 *str; - -} SAM_DISPINFO_5; - - -typedef struct sam_dispinfo_ctr_info -{ - union - { - SAM_DISPINFO_1 *info1; /* users/names/descriptions */ - SAM_DISPINFO_2 *info2; /* trust accounts */ - SAM_DISPINFO_3 *info3; /* domain groups/descriptions */ - SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */ - SAM_DISPINFO_5 *info5; /* group list (ASCII) */ - void *info; /* allows assignment without typecasting, */ - - } sam; - -} SAM_DISPINFO_CTR; - - -/* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */ -typedef struct q_samr_query_disp_info -{ - POLICY_HND domain_pol; - - uint16 switch_level; /* see SAM_DISPINFO_CTR above */ - /* align */ - - uint32 start_idx; /* start enumeration index */ - uint32 max_entries; /* maximum number of entries to return */ - uint32 max_size; /* recommended data size; if exceeded server - should return STATUS_MORE_ENTRIES */ - -} SAMR_Q_QUERY_DISPINFO; - - -/* SAMR_R_QUERY_DISPINFO */ -typedef struct r_samr_query_dispinfo_info -{ - uint32 total_size; /* total data size for all matching entries - (0 = uncalculated) */ - uint32 data_size; /* actual data size returned = size of SAM_ENTRY - structures + total length of strings */ - - uint16 switch_level; /* see SAM_DISPINFO_CTR above */ - /* align */ - - uint32 num_entries; /* number of entries returned */ - uint32 ptr_entries; - uint32 num_entries2; - - SAM_DISPINFO_CTR *ctr; - - NTSTATUS status; - -} SAMR_R_QUERY_DISPINFO; - /* SAMR_Q_GET_DISPENUM_INDEX */ typedef struct q_samr_get_dispenum_index { diff --git a/source3/rpc_client/cli_samr.c b/source3/rpc_client/cli_samr.c index 858bfc304b..ea25ddfe52 100644 --- a/source3/rpc_client/cli_samr.c +++ b/source3/rpc_client/cli_samr.c @@ -510,57 +510,6 @@ void get_query_dispinfo_params(int loop_count, uint32 *max_entries, *max_size = 131071; break; } -} - -/* Query display info */ - -NTSTATUS rpccli_samr_query_dispinfo(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, - POLICY_HND *domain_pol, uint32 *start_idx, - uint16 switch_value, uint32 *num_entries, - uint32 max_entries, uint32 max_size, - SAM_DISPINFO_CTR *ctr) -{ - prs_struct qbuf, rbuf; - SAMR_Q_QUERY_DISPINFO q; - SAMR_R_QUERY_DISPINFO r; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - - DEBUG(10,("cli_samr_query_dispinfo for start_idx = %u\n", *start_idx)); - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - *num_entries = 0; - - /* Marshall data and send request */ - - init_samr_q_query_dispinfo(&q, domain_pol, switch_value, - *start_idx, max_entries, max_size); - - r.ctr = ctr; - - CLI_DO_RPC(cli, mem_ctx, PI_SAMR, SAMR_QUERY_DISPINFO, - q, r, - qbuf, rbuf, - samr_io_q_query_dispinfo, - samr_io_r_query_dispinfo, - NT_STATUS_UNSUCCESSFUL); - - /* Return output parameters */ - - result = r.status; - - if (!NT_STATUS_IS_OK(result) && - NT_STATUS_V(result) != NT_STATUS_V(STATUS_MORE_ENTRIES)) { - goto done; - } - - *num_entries = r.num_entries; - *start_idx += r.num_entries; /* No next_idx in this structure! */ - - done: - return result; } /* Lookup rids. Note that NT4 seems to crash if more than ~1000 rids are 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 @@ -180,312 +180,6 @@ void init_samr_DomInfo12(struct samr_DomInfo12 *r, r->lockout_threshold = lockout_threshold; } -/******************************************************************* -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. ********************************************************************/ @@ -660,59 +354,6 @@ bool samr_io_r_enum_dom_users(const char *desc, SAMR_R_ENUM_DOM_USERS * r_u, return True; } -/******************************************************************* -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. ********************************************************************/ @@ -757,51 +398,6 @@ NTSTATUS init_sam_dispinfo_1(TALLOC_CTX *ctx, return NT_STATUS_OK; } -/******************************************************************* -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. ********************************************************************/ @@ -843,53 +439,6 @@ NTSTATUS init_sam_dispinfo_2(TALLOC_CTX *ctx, return NT_STATUS_OK; } -/******************************************************************* -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. ********************************************************************/ @@ -931,53 +480,6 @@ NTSTATUS init_sam_dispinfo_3(TALLOC_CTX *ctx, return NT_STATUS_OK; } -/******************************************************************* -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. ********************************************************************/ @@ -1014,52 +516,6 @@ NTSTATUS init_sam_dispinfo_4(TALLOC_CTX *ctx, return NT_STATUS_OK; } -/******************************************************************* -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. ********************************************************************/ @@ -1096,164 +552,6 @@ NTSTATUS init_sam_dispinfo_5(TALLOC_CTX *ctx, return NT_STATUS_OK; } -/******************************************************************* -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. ********************************************************************/ diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 7d057132dd..e8a4da792a 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -1282,8 +1282,6 @@ static NTSTATUS rpc_user_list_internals(const DOM_SID *domain_sid, POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; uint32 start_idx=0, num_entries, i, loop_count = 0; - SAM_DISPINFO_CTR ctr; - SAM_DISPINFO_1 info1; /* Get sam policy handle */ -- cgit