summaryrefslogtreecommitdiff
path: root/source3/utils
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-10 05:05:37 +0100
committerGünther Deschner <gd@samba.org>2008-03-10 05:05:37 +0100
commitd09f0d281cf7014f51c7de4864d0366badbc8f0c (patch)
tree2d48a8511b05965e29e7345aaf97d70321f2ed74 /source3/utils
parenta6fa0ca3219db5d849ad835fc994cb158c87e02a (diff)
downloadsamba-d09f0d281cf7014f51c7de4864d0366badbc8f0c.tar.gz
samba-d09f0d281cf7014f51c7de4864d0366badbc8f0c.tar.bz2
samba-d09f0d281cf7014f51c7de4864d0366badbc8f0c.zip
Use rpccli_srvsvc_NetShareEnumAll in smbtree.
Guenther (This used to be commit 0cf761f604975930f38213233e4bbf48d7ae7283)
Diffstat (limited to 'source3/utils')
-rw-r--r--source3/utils/smbtree.c36
1 files changed, 21 insertions, 15 deletions
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; i<ctr.num_entries; i++) {
- SRV_SHARE_INFO_1 *info = &ctr.share.info1[i];
- char *name, *comment;
- name = rpcstr_pull_unistr2_talloc(
- mem_ctx, &info->info_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; i<total_entries; i++) {
+ struct srvsvc_NetShareInfo1 info = info_ctr.ctr.ctr1->array[i];
+ fn(info.name, info.type, info.comment, state);
}
TALLOC_FREE(mem_ctx);