summaryrefslogtreecommitdiff
path: root/source3/libsmb/libsmb_dir.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-12 12:58:44 +0100
committerAndreas Schneider <asn@samba.org>2011-01-13 14:11:55 +0100
commit44e048f7a89a2fd26cca680cb9e53c02103d7750 (patch)
tree73e4a99f11fbb538dd3829a78f00a60115db69c6 /source3/libsmb/libsmb_dir.c
parentfccfd29283154d9ec252fcb4c26f21301150dc5f (diff)
downloadsamba-44e048f7a89a2fd26cca680cb9e53c02103d7750.tar.gz
samba-44e048f7a89a2fd26cca680cb9e53c02103d7750.tar.bz2
samba-44e048f7a89a2fd26cca680cb9e53c02103d7750.zip
s3-libsmbclient: prefer dcerpc_srvsvc_X functions.
Guenther Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/libsmb/libsmb_dir.c')
-rw-r--r--source3/libsmb/libsmb_dir.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c
index fdaf949c08..98436a39e9 100644
--- a/source3/libsmb/libsmb_dir.c
+++ b/source3/libsmb/libsmb_dir.c
@@ -26,7 +26,7 @@
#include "popt_common.h"
#include "libsmbclient.h"
#include "libsmb_internal.h"
-#include "../librpc/gen_ndr/cli_srvsvc.h"
+#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
/*
* Routine to open a directory
@@ -270,6 +270,7 @@ net_share_enum_rpc(struct cli_state *cli,
NTSTATUS nt_status;
uint32_t resume_handle = 0;
uint32_t total_entries = 0;
+ struct dcerpc_binding_handle *b;
/* Open the server service pipe */
nt_status = cli_rpc_pipe_open_noauth(cli, &ndr_table_srvsvc.syntax_id,
@@ -285,8 +286,10 @@ net_share_enum_rpc(struct cli_state *cli,
info_ctr.level = 1;
info_ctr.ctr.ctr1 = &ctr1;
+ b = pipe_hnd->binding_handle;
+
/* Issue the NetShareEnum RPC call and retrieve the response */
- nt_status = rpccli_srvsvc_NetShareEnumAll(pipe_hnd, talloc_tos(),
+ nt_status = dcerpc_srvsvc_NetShareEnumAll(b, talloc_tos(),
pipe_hnd->desthost,
&info_ctr,
preferred_len,
@@ -295,12 +298,23 @@ net_share_enum_rpc(struct cli_state *cli,
&result);
/* Was it successful? */
- if (!NT_STATUS_IS_OK(nt_status) || !W_ERROR_IS_OK(result) ||
- total_entries == 0) {
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ /* Nope. Go clean up. */
+ result = ntstatus_to_werror(nt_status);
+ goto done;
+ }
+
+ if (!W_ERROR_IS_OK(result)) {
/* Nope. Go clean up. */
goto done;
}
+ if (total_entries == 0) {
+ /* Nope. Go clean up. */
+ result = WERR_GENERAL_FAILURE;
+ goto done;
+ }
+
/* For each returned entry... */
for (i = 0; i < info_ctr.ctr.ctr1->count; i++) {