[SCM] Samba Shared Repository - branch v3-2-test updated - release-3-2-0pre2-175-g1121633

Günther Deschner gd at samba.org
Mon Mar 10 03:34:10 GMT 2008


The branch, v3-2-test has been updated
       via  1121633652ffb77dce8df9cc91b7dfc2d55fd348 (commit)
      from  8168fd583cfc2ad64e5c1aa67047d8c3c607993a (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test


- Log -----------------------------------------------------------------
commit 1121633652ffb77dce8df9cc91b7dfc2d55fd348
Author: Günther Deschner <gd at samba.org>
Date:   Mon Mar 10 04:33:06 2008 +0100

    Use rpccli_srvsvc_NetShareEnumAll in smbclient.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 source/client/client.c |   36 +++++++++++++++++++++---------------
 1 files changed, 21 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/client/client.c b/source/client/client.c
index 67060cb..b0b3e8e 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);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list