1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Pass down max_size parameter to cli_samr_query_dispinfo() instead of

using a hardcoded value later on.

Added a helper function that returns the observed values for
max_entries and max_size for each cli_samr_query_dispinfo() call.
These values were obtained from watching the NT4 user manager
application with ethereal and are the only ones that can enumerate a
60k user domain reliably under Windows 2000.
This commit is contained in:
Tim Potter 0001-01-01 00:00:00 +00:00
parent c3b077f763
commit 2eea2813d9

View File

@ -961,12 +961,45 @@ NTSTATUS cli_samr_query_dom_info(struct cli_state *cli, TALLOC_CTX *mem_ctx,
return result; return result;
} }
/* This function returns the bizzare set of (max_entries, max_size) required
for the QueryDisplayInfo RPC to actually work against a domain controller
with large (10k and higher) numbers of users. These values were
obtained by inspection using ethereal and NT4 running User Manager. */
void get_query_dispinfo_params(int loop_count, uint32 *max_entries,
uint32 *max_size)
{
switch(loop_count) {
case 0:
*max_entries = 512;
*max_size = 16383;
break;
case 1:
*max_entries = 1024;
*max_size = 32766;
break;
case 2:
*max_entries = 2048;
*max_size = 65532;
break;
case 3:
*max_entries = 4096;
*max_size = 131064;
break;
default: /* loop_count >= 4 */
*max_entries = 4096;
*max_size = 131071;
break;
}
}
/* Query display info */ /* Query display info */
NTSTATUS cli_samr_query_dispinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx, NTSTATUS cli_samr_query_dispinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
POLICY_HND *domain_pol, uint32 *start_idx, POLICY_HND *domain_pol, uint32 *start_idx,
uint16 switch_value, uint32 *num_entries, uint16 switch_value, uint32 *num_entries,
uint32 max_entries, SAM_DISPINFO_CTR *ctr) uint32 max_entries, uint32 max_size,
SAM_DISPINFO_CTR *ctr)
{ {
prs_struct qbuf, rbuf; prs_struct qbuf, rbuf;
SAMR_Q_QUERY_DISPINFO q; SAMR_Q_QUERY_DISPINFO q;
@ -984,7 +1017,7 @@ NTSTATUS cli_samr_query_dispinfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
/* Marshall data and send request */ /* Marshall data and send request */
init_samr_q_query_dispinfo(&q, domain_pol, switch_value, init_samr_q_query_dispinfo(&q, domain_pol, switch_value,
*start_idx, max_entries); *start_idx, max_entries, max_size);
if (!samr_io_q_query_dispinfo("", &q, &qbuf, 0) || if (!samr_io_q_query_dispinfo("", &q, &qbuf, 0) ||
!rpc_api_pipe_req(cli, SAMR_QUERY_DISPINFO, &qbuf, &rbuf)) { !rpc_api_pipe_req(cli, SAMR_QUERY_DISPINFO, &qbuf, &rbuf)) {