summaryrefslogtreecommitdiff
path: root/source3/libgpo
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-10-29 11:56:51 -0700
committerJeremy Allison <jra@samba.org>2010-10-29 19:40:16 +0000
commit14ff2e8de9bd8d0064762234555260f5eea643fe (patch)
treeabd73a321e4f9855c9fcaf729d7a9ef7f91112ab /source3/libgpo
parent606a447503defdeddc84ae03e06b392517c840c5 (diff)
downloadsamba-14ff2e8de9bd8d0064762234555260f5eea643fe.tar.gz
samba-14ff2e8de9bd8d0064762234555260f5eea643fe.tar.bz2
samba-14ff2e8de9bd8d0064762234555260f5eea643fe.zip
Fix bug #7700 - Improvement of return code of smbclient
Based on an initial patch from H Hasegawa <hasegawa.hiroyuki@fujixerox.co.jp>. Convert cli_list and associated functions to take calls that return NTSTATUS. Jeremy. Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Fri Oct 29 19:40:16 UTC 2010 on sn-devel-104
Diffstat (limited to 'source3/libgpo')
-rw-r--r--source3/libgpo/gpo_filesync.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c
index d85df1f7e1..4e3b93809e 100644
--- a/source3/libgpo/gpo_filesync.c
+++ b/source3/libgpo/gpo_filesync.c
@@ -30,7 +30,7 @@ struct sync_context {
uint16_t attribute;
};
-static void gpo_sync_func(const char *mnt,
+static NTSTATUS gpo_sync_func(const char *mnt,
struct file_info *info,
const char *mask,
void *state);
@@ -98,7 +98,7 @@ NTSTATUS gpo_copy_file(TALLOC_CTX *mem_ctx,
static NTSTATUS gpo_copy_dir(const char *unix_path)
{
if ((mkdir(unix_path, 0644)) < 0 && errno != EEXIST) {
- return NT_STATUS_ACCESS_DENIED;
+ return map_nt_error_from_unix(errno);
}
return NT_STATUS_OK;
@@ -108,7 +108,7 @@ static NTSTATUS gpo_copy_dir(const char *unix_path)
sync files
****************************************************************/
-static bool gpo_sync_files(struct sync_context *ctx)
+static NTSTATUS gpo_sync_files(struct sync_context *ctx)
{
NTSTATUS status;
@@ -119,17 +119,17 @@ static bool gpo_sync_files(struct sync_context *ctx)
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("listing [%s] failed with error: %s\n",
ctx->mask, nt_errstr(status)));
- return false;
+ return status;
}
- return true;
+ return status;
}
/****************************************************************
syncronisation call back
****************************************************************/
-static void gpo_sync_func(const char *mnt,
+static NTSTATUS gpo_sync_func(const char *mnt,
struct file_info *info,
const char *mask,
void *state)
@@ -143,7 +143,7 @@ static void gpo_sync_func(const char *mnt,
ctx = (struct sync_context *)state;
if (strequal(info->name, ".") || strequal(info->name, "..")) {
- return;
+ return NT_STATUS_OK;
}
DEBUG(5,("gpo_sync_func: got mask: [%s], name: [%s]\n",
@@ -165,6 +165,7 @@ static void gpo_sync_func(const char *mnt,
if (!NT_STATUS_IS_OK(result)) {
DEBUG(1,("failed to copy dir: %s\n",
nt_errstr(result)));
+ return result;
}
old_nt_dir = ctx->remote_path;
@@ -178,15 +179,17 @@ static void gpo_sync_func(const char *mnt,
nt_dir);
if (!ctx->local_path || !ctx->mask || !ctx->remote_path) {
DEBUG(0,("gpo_sync_func: ENOMEM\n"));
- return;
+ return NT_STATUS_NO_MEMORY;
}
- if (!gpo_sync_files(ctx)) {
+ result = gpo_sync_files(ctx);
+ if (!NT_STATUS_IS_OK(result)) {
DEBUG(0,("could not sync files\n"));
+ return result;
}
ctx->remote_path = old_nt_dir;
ctx->local_path = old_unix_dir;
- return;
+ return NT_STATUS_OK;
}
DEBUG(3,("got file: [%s]\n", info->name));
@@ -205,6 +208,7 @@ static void gpo_sync_func(const char *mnt,
DEBUG(1,("failed to copy file: %s\n",
nt_errstr(result)));
}
+ return result;
}
@@ -232,9 +236,5 @@ NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- if (!gpo_sync_files(&ctx)) {
- return NT_STATUS_NO_SUCH_FILE;
- }
-
- return NT_STATUS_OK;
+ return gpo_sync_files(&ctx);
}