Changeset 745 for trunk/server/source3/libgpo/gpo_filesync.c
- Timestamp:
- Nov 27, 2012, 4:43:17 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 581,587,591,594,597,600,615,618,740
- Property svn:mergeinfo changed
-
trunk/server/source3/libgpo/gpo_filesync.c
r414 r745 19 19 20 20 #include "includes.h" 21 #include "system/filesys.h" 22 #include "libsmb/libsmb.h" 23 #include "../libgpo/gpo.h" 24 #include "libgpo/gpo_proto.h" 21 25 22 26 struct sync_context { … … 29 33 }; 30 34 31 static voidgpo_sync_func(const char *mnt,32 file_info *info,35 static NTSTATUS gpo_sync_func(const char *mnt, 36 struct file_info *info, 33 37 const char *mask, 34 38 void *state); … … 97 101 { 98 102 if ((mkdir(unix_path, 0644)) < 0 && errno != EEXIST) { 99 return NT_STATUS_ACCESS_DENIED;103 return map_nt_error_from_unix(errno); 100 104 } 101 105 … … 107 111 ****************************************************************/ 108 112 109 static bool gpo_sync_files(struct sync_context *ctx) 110 { 113 static NTSTATUS gpo_sync_files(struct sync_context *ctx) 114 { 115 NTSTATUS status; 116 111 117 DEBUG(3,("calling cli_list with mask: %s\n", ctx->mask)); 112 118 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; 124 128 } 125 129 … … 128 132 ****************************************************************/ 129 133 130 static voidgpo_sync_func(const char *mnt,131 file_info *info,134 static NTSTATUS gpo_sync_func(const char *mnt, 135 struct file_info *info, 132 136 const char *mask, 133 137 void *state) … … 142 146 143 147 if (strequal(info->name, ".") || strequal(info->name, "..")) { 144 return ;148 return NT_STATUS_OK; 145 149 } 146 150 … … 148 152 mask, info->name)); 149 153 150 if (info->mode & aDIR) {154 if (info->mode & FILE_ATTRIBUTE_DIRECTORY) { 151 155 152 156 DEBUG(3,("got dir: [%s]\n", info->name)); … … 164 168 DEBUG(1,("failed to copy dir: %s\n", 165 169 nt_errstr(result))); 170 return result; 166 171 } 167 172 … … 177 182 if (!ctx->local_path || !ctx->mask || !ctx->remote_path) { 178 183 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)) { 182 188 DEBUG(0,("could not sync files\n")); 189 return result; 183 190 } 184 191 185 192 ctx->remote_path = old_nt_dir; 186 193 ctx->local_path = old_unix_dir; 187 return ;194 return NT_STATUS_OK; 188 195 } 189 196 … … 204 211 nt_errstr(result))); 205 212 } 213 return result; 206 214 } 207 215 … … 222 230 ctx.remote_path = CONST_DISCARD(char *, nt_path); 223 231 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); 225 233 226 234 ctx.mask = talloc_asprintf(mem_ctx, … … 231 239 } 232 240 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.