diff options
Diffstat (limited to 'source3/libgpo')
-rw-r--r-- | source3/libgpo/gpo_filesync.c | 30 |
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); } |