Ignore:
Timestamp:
Nov 27, 2012, 4:43:17 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.0

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/source3/libgpo/gpo_filesync.c

    r414 r745  
    1919
    2020#include "includes.h"
     21#include "system/filesys.h"
     22#include "libsmb/libsmb.h"
     23#include "../libgpo/gpo.h"
     24#include "libgpo/gpo_proto.h"
    2125
    2226struct sync_context {
     
    2933};
    3034
    31 static void gpo_sync_func(const char *mnt,
    32                           file_info *info,
     35static NTSTATUS gpo_sync_func(const char *mnt,
     36                          struct file_info *info,
    3337                          const char *mask,
    3438                          void *state);
     
    97101{
    98102        if ((mkdir(unix_path, 0644)) < 0 && errno != EEXIST) {
    99                 return NT_STATUS_ACCESS_DENIED;
     103                return map_nt_error_from_unix(errno);
    100104        }
    101105
     
    107111****************************************************************/
    108112
    109 static bool gpo_sync_files(struct sync_context *ctx)
    110 {
     113static NTSTATUS gpo_sync_files(struct sync_context *ctx)
     114{
     115        NTSTATUS status;
     116
    111117        DEBUG(3,("calling cli_list with mask: %s\n", ctx->mask));
    112118
    113         if (cli_list(ctx->cli,
    114                      ctx->mask,
    115                      ctx->attribute,
    116                      gpo_sync_func,
    117                      ctx) == -1) {
    118                 DEBUG(1,("listing [%s] failed with error: %s\n",
    119                         ctx->mask, cli_errstr(ctx->cli)));
    120                 return false;
    121         }
    122 
    123         return true;
     119        status = cli_list(ctx->cli, ctx->mask, ctx->attribute, gpo_sync_func,
     120                          ctx);
     121        if (!NT_STATUS_IS_OK(status)) {
     122                DEBUG(1, ("listing [%s] failed with error: %s\n",
     123                          ctx->mask, nt_errstr(status)));
     124                return status;
     125        }
     126
     127        return status;
    124128}
    125129
     
    128132****************************************************************/
    129133
    130 static void gpo_sync_func(const char *mnt,
    131                           file_info *info,
     134static NTSTATUS gpo_sync_func(const char *mnt,
     135                          struct file_info *info,
    132136                          const char *mask,
    133137                          void *state)
     
    142146
    143147        if (strequal(info->name, ".") || strequal(info->name, "..")) {
    144                 return;
     148                return NT_STATUS_OK;
    145149        }
    146150
     
    148152                mask, info->name));
    149153
    150         if (info->mode & aDIR) {
     154        if (info->mode & FILE_ATTRIBUTE_DIRECTORY) {
    151155
    152156                DEBUG(3,("got dir: [%s]\n", info->name));
     
    164168                        DEBUG(1,("failed to copy dir: %s\n",
    165169                                nt_errstr(result)));
     170                        return result;
    166171                }
    167172
     
    177182                if (!ctx->local_path || !ctx->mask || !ctx->remote_path) {
    178183                        DEBUG(0,("gpo_sync_func: ENOMEM\n"));
    179                         return;
    180                 }
    181                 if (!gpo_sync_files(ctx)) {
     184                        return NT_STATUS_NO_MEMORY;
     185                }
     186                result = gpo_sync_files(ctx);
     187                if (!NT_STATUS_IS_OK(result)) {
    182188                        DEBUG(0,("could not sync files\n"));
     189                        return result;
    183190                }
    184191
    185192                ctx->remote_path = old_nt_dir;
    186193                ctx->local_path = old_unix_dir;
    187                 return;
     194                return NT_STATUS_OK;
    188195        }
    189196
     
    204211                        nt_errstr(result)));
    205212        }
     213        return result;
    206214}
    207215
     
    222230        ctx.remote_path = CONST_DISCARD(char *, nt_path);
    223231        ctx.local_path  = CONST_DISCARD(char *, local_path);
    224         ctx.attribute   = (aSYSTEM | aHIDDEN | aDIR);
     232        ctx.attribute   = (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_DIRECTORY);
    225233
    226234        ctx.mask = talloc_asprintf(mem_ctx,
     
    231239        }
    232240
    233         if (!gpo_sync_files(&ctx)) {
    234                 return NT_STATUS_NO_SUCH_FILE;
    235         }
    236 
    237         return NT_STATUS_OK;
    238 }
     241        return gpo_sync_files(&ctx);
     242}
Note: See TracChangeset for help on using the changeset viewer.