diff options
author | Günther Deschner <gd@samba.org> | 2008-03-10 04:33:06 +0100 |
---|---|---|
committer | Karolin Seeger <kseeger@bando.sernet.private> | 2008-03-31 14:21:08 +0200 |
commit | 48fc51d99719c01cbbc00920aa4cf4a329e68b8e (patch) | |
tree | 837e30ba54784adcbb1a27645e7f8eea87e857ae /source/client | |
parent | ae629ba2117c27c815cf6b6784b35e4546c93e3c (diff) | |
download | samba-48fc51d99719c01cbbc00920aa4cf4a329e68b8e.tar.gz samba-48fc51d99719c01cbbc00920aa4cf4a329e68b8e.tar.xz samba-48fc51d99719c01cbbc00920aa4cf4a329e68b8e.zip |
Use rpccli_srvsvc_NetShareEnumAll in smbclient.
Guenther
(cherry picked from commit 1121633652ffb77dce8df9cc91b7dfc2d55fd348)
Diffstat (limited to 'source/client')
-rw-r--r-- | source/client/client.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/source/client/client.c b/source/client/client.c index 67e5030473c..882ed4dbdd8 100644 --- a/source/client/client.c +++ b/source/client/client.c @@ -3627,13 +3627,13 @@ static bool browse_host_rpc(bool sort) NTSTATUS status; struct rpc_pipe_client *pipe_hnd; TALLOC_CTX *frame = talloc_stackframe(); - ENUM_HND enum_hnd; WERROR werr; - SRV_SHARE_INFO_CTR ctr; + struct srvsvc_NetShareInfoCtr info_ctr; + struct srvsvc_NetShareCtr1 ctr1; + uint32_t resume_handle = 0; + uint32_t total_entries = 0; int i; - init_enum_hnd(&enum_hnd, 0); - pipe_hnd = cli_rpc_pipe_open_noauth(cli, PI_SRVSVC, &status); if (pipe_hnd == NULL) { @@ -3643,23 +3643,29 @@ static bool browse_host_rpc(bool sort) return false; } - werr = rpccli_srvsvc_net_share_enum(pipe_hnd, frame, 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, frame, + 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)) { cli_rpc_pipe_close(pipe_hnd); TALLOC_FREE(frame); 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( - frame, &info->info_1_str.uni_netname); - comment = rpcstr_pull_unistr2_talloc( - frame, &info->info_1_str.uni_remark); - browse_fn(name, info->info_1.type, comment, NULL); + for (i=0; i < info_ctr.ctr.ctr1->count; i++) { + struct srvsvc_NetShareInfo1 info = info_ctr.ctr.ctr1->array[i]; + browse_fn(info.name, info.type, info.comment, NULL); } cli_rpc_pipe_close(pipe_hnd); |