diff options
-rw-r--r-- | source3/nsswitch/winbindd_rpc.c | 15 | ||||
-rw-r--r-- | source3/rpcclient/cmd_samr.c | 28 | ||||
-rw-r--r-- | source3/utils/net_rpc.c | 11 |
3 files changed, 41 insertions, 13 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index edeacdec6d..b260e55c86 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -39,7 +39,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, POLICY_HND dom_pol; BOOL got_dom_pol = False; uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED; - int i; + int i, loop_count = 0; DEBUG(3,("rpc: query_user_list\n")); @@ -65,7 +65,7 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, do { SAM_DISPINFO_CTR ctr; SAM_DISPINFO_1 info1; - uint32 count = 0, start=i; + uint32 count = 0, start=i, max_entries, max_size; int j; TALLOC_CTX *ctx2; @@ -77,10 +77,15 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, goto done; } + get_query_dispinfo_params( + loop_count, &max_entries, &max_size); + /* Query display info level 1 */ - result = cli_samr_query_dispinfo(hnd->cli, ctx2, - &dom_pol, &start, 1, - &count, 0xFFFF, &ctr); + result = cli_samr_query_dispinfo( + hnd->cli, ctx2, &dom_pol, &start, 1, &count, + max_entries, max_size, &ctr); + + loop_count++; if (!NT_STATUS_IS_OK(result) && !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) break; diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c index fbc4d49819..9e8d105c46 100644 --- a/source3/rpcclient/cmd_samr.c +++ b/source3/rpcclient/cmd_samr.c @@ -863,7 +863,7 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, { POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 start_idx=0, max_entries=250, num_entries, i; + uint32 start_idx=0, max_entries=250, max_size = 0xffff, num_entries, i; uint32 access_mask = MAXIMUM_ALLOWED_ACCESS; uint32 info_level = 1; SAM_DISPINFO_CTR ctr; @@ -872,9 +872,11 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, SAM_DISPINFO_3 info3; SAM_DISPINFO_4 info4; SAM_DISPINFO_5 info5; + int loop_count = 0; + BOOL got_params = False; /* Use get_query_dispinfo_params() or not? */ if (argc > 5) { - printf("Usage: %s [info level] [start index] [max entries] [access mask]\n", argv[0]); + printf("Usage: %s [info level] [start index] [max entries] [max size] [access mask]\n", argv[0]); return NT_STATUS_OK; } @@ -884,11 +886,18 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, if (argc >= 3) sscanf(argv[2], "%i", &start_idx); - if (argc >= 4) + if (argc >= 4) { sscanf(argv[3], "%i", &max_entries); + got_params = True; + } + + if (argc >= 5) { + sscanf(argv[4], "%i", &max_size); + got_params = True; + } - if (argc >= 5) - sscanf(argv[4], "%x", &access_mask); + if (argc >= 6) + sscanf(argv[5], "%x", &access_mask); /* Get sam policy handle */ @@ -938,9 +947,16 @@ static NTSTATUS cmd_samr_query_dispinfo(struct cli_state *cli, while(1) { + if (!got_params) + get_query_dispinfo_params( + loop_count, &max_entries, &max_size); + result = cli_samr_query_dispinfo(cli, mem_ctx, &domain_pol, &start_idx, info_level, - &num_entries, max_entries, &ctr); + &num_entries, max_entries, + max_size, &ctr); + + loop_count++; if (!NT_STATUS_IS_OK(result) && !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) break; diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c index 60adcfdf6e..922fc027e6 100644 --- a/source3/utils/net_rpc.c +++ b/source3/utils/net_rpc.c @@ -779,7 +779,7 @@ rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli, { POLICY_HND connect_pol, domain_pol; NTSTATUS result = NT_STATUS_UNSUCCESSFUL; - uint32 start_idx=0, max_entries=250, num_entries, i; + uint32 start_idx=0, num_entries, i, loop_count = 0; SAM_DISPINFO_CTR ctr; SAM_DISPINFO_1 info1; @@ -809,9 +809,16 @@ rpc_user_list_internals(const DOM_SID *domain_sid, struct cli_state *cli, "\n-----------------------------\n"); do { fstring user, desc; + uint32 max_entries, max_size; + + get_query_dispinfo_params( + loop_count, &max_entries, &max_size); + result = cli_samr_query_dispinfo(cli, mem_ctx, &domain_pol, &start_idx, 1, &num_entries, - max_entries, &ctr); + max_entries, max_size, &ctr); + loop_count++; + for (i = 0; i < num_entries; i++) { unistr2_to_ascii(user, &(&ctr.sam.info1->str[i])->uni_acct_name, sizeof(user)-1); if (opt_long_list_entries) |