From 14ff2e8de9bd8d0064762234555260f5eea643fe Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 29 Oct 2010 11:56:51 -0700 Subject: Fix bug #7700 - Improvement of return code of smbclient Based on an initial patch from H Hasegawa . Convert cli_list and associated functions to take calls that return NTSTATUS. Jeremy. Autobuild-User: Jeremy Allison Autobuild-Date: Fri Oct 29 19:40:16 UTC 2010 on sn-devel-104 --- source3/libsmb/libsmb_dir.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source3/libsmb/libsmb_dir.c') diff --git a/source3/libsmb/libsmb_dir.c b/source3/libsmb/libsmb_dir.c index 9398f92612..fdaf949c08 100644 --- a/source3/libsmb/libsmb_dir.c +++ b/source3/libsmb/libsmb_dir.c @@ -147,9 +147,10 @@ list_unique_wg_fn(const char *name, dirent_type = dir->dir_type; if (add_dirent(dir, name, comment, dirent_type) < 0) { - /* An error occurred, what do we do? */ /* FIXME: Add some code here */ + /* Change cli_NetServerEnum to take a fn + returning NTSTATUS... JRA. */ } /* Point to the one just added */ @@ -227,14 +228,14 @@ list_fn(const char *name, } if (add_dirent(dir, name, comment, dirent_type) < 0) { - /* An error occurred, what do we do? */ /* FIXME: Add some code here */ - + /* Change cli_NetServerEnum to take a fn + returning NTSTATUS... JRA. */ } } -static void +static NTSTATUS dir_list_fn(const char *mnt, struct file_info *finfo, const char *mask, @@ -243,13 +244,10 @@ dir_list_fn(const char *mnt, if (add_dirent((SMBCFILE *)state, finfo->name, "", (finfo->mode&aDIR?SMBC_DIR:SMBC_FILE)) < 0) { - - /* Handle an error ... */ - - /* FIXME: Add some code ... */ - + SMBCFILE *dir = (SMBCFILE *)state; + return map_nt_error_from_unix(dir->dir_error); } - + return NT_STATUS_OK; } static int @@ -1211,7 +1209,7 @@ SMBC_mkdir_ctx(SMBCCTX *context, * Our list function simply checks to see if a directory is not empty */ -static void +static NTSTATUS rmdir_list_fn(const char *mnt, struct file_info *finfo, const char *mask, @@ -1222,6 +1220,7 @@ rmdir_list_fn(const char *mnt, bool *smbc_rmdir_dirempty = (bool *)state; *smbc_rmdir_dirempty = false; } + return NT_STATUS_OK; } /* -- cgit