From d09f0d281cf7014f51c7de4864d0366badbc8f0c Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Mon, 10 Mar 2008 05:05:37 +0100 Subject: Use rpccli_srvsvc_NetShareEnumAll in smbtree. Guenther (This used to be commit 0cf761f604975930f38213233e4bbf48d7ae7283) --- source3/utils/smbtree.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) (limited to 'source3') diff --git a/source3/utils/smbtree.c b/source3/utils/smbtree.c index 572f3dca83..48eae5ac5c 100644 --- a/source3/utils/smbtree.c +++ b/source3/utils/smbtree.c @@ -150,10 +150,12 @@ static bool get_rpc_shares(struct cli_state *cli, NTSTATUS status; struct rpc_pipe_client *pipe_hnd; TALLOC_CTX *mem_ctx; - ENUM_HND enum_hnd; WERROR werr; - SRV_SHARE_INFO_CTR ctr; + struct srvsvc_NetShareInfoCtr info_ctr; + struct srvsvc_NetShareCtr1 ctr1; int i; + uint32_t resume_handle = 0; + uint32_t total_entries = 0; mem_ctx = talloc_new(NULL); if (mem_ctx == NULL) { @@ -161,8 +163,6 @@ static bool get_rpc_shares(struct cli_state *cli, return False; } - init_enum_hnd(&enum_hnd, 0); - pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status); if (pipe_hnd == NULL) { @@ -172,23 +172,29 @@ static bool get_rpc_shares(struct cli_state *cli, return False; } - werr = rpccli_srvsvc_net_share_enum(pipe_hnd, mem_ctx, 1, &ctr, - 0xffffffff, &enum_hnd); + ZERO_STRUCT(info_ctr); + ZERO_STRUCT(ctr1); + + info_ctr.level = 1; + info_ctr.ctr.ctr1 = &ctr1; + + status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, mem_ctx, + pipe_hnd->cli->desthost, + &info_ctr, + 0xffffffff, + &total_entries, + &resume_handle, + &werr); - if (!W_ERROR_IS_OK(werr)) { + if (!NT_STATUS_IS_OK(status) || !W_ERROR_IS_OK(werr)) { TALLOC_FREE(mem_ctx); cli_rpc_pipe_close(pipe_hnd); return False; } - for (i=0; iinfo_1_str.uni_netname); - comment = rpcstr_pull_unistr2_talloc( - mem_ctx, &info->info_1_str.uni_remark); - fn(name, info->info_1.type, comment, state); + for (i=0; iarray[i]; + fn(info.name, info.type, info.comment, state); } TALLOC_FREE(mem_ctx); -- cgit