summaryrefslogtreecommitdiff
path: root/source3/libgpo
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libgpo')
-rw-r--r--source3/libgpo/gpo_fetch.c17
-rw-r--r--source3/libgpo/gpo_filesync.c20
2 files changed, 26 insertions, 11 deletions
diff --git a/source3/libgpo/gpo_fetch.c b/source3/libgpo/gpo_fetch.c
index 6be986d5d9..d9995eca21 100644
--- a/source3/libgpo/gpo_fetch.c
+++ b/source3/libgpo/gpo_fetch.c
@@ -31,7 +31,7 @@ NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
char **unix_path)
{
fstring tok;
- pstring path;
+ char *path = NULL;
*server = NULL;
*service = NULL;
@@ -63,15 +63,22 @@ NTSTATUS gpo_explode_filesyspath(TALLOC_CTX *mem_ctx,
return NT_STATUS_NO_MEMORY;
}
- pstrcpy(path, lock_path(GPO_CACHE_DIR));
- pstrcat(path, "/");
- pstrcat(path, file_sys_path);
- pstring_sub(path, "\\", "/");
+ if ((path = talloc_asprintf(mem_ctx,
+ "%s/%s",
+ lock_path(GPO_CACHE_DIR),
+ file_sys_path)) == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ path = talloc_string_sub(mem_ctx, path, "\\", "/");
+ if (!path) {
+ return NT_STATUS_NO_MEMORY;
+ }
if ((*unix_path = talloc_strdup(mem_ctx, path)) == NULL) {
return NT_STATUS_NO_MEMORY;
}
+ TALLOC_FREE(path);
return NT_STATUS_OK;
}
diff --git a/source3/libgpo/gpo_filesync.c b/source3/libgpo/gpo_filesync.c
index c4b65210c1..9f6557ef32 100644
--- a/source3/libgpo/gpo_filesync.c
+++ b/source3/libgpo/gpo_filesync.c
@@ -24,7 +24,7 @@ struct sync_context {
struct cli_state *cli;
char *remote_path;
char *local_path;
- pstring mask;
+ char *mask;
uint16_t attribute;
};
@@ -171,9 +171,13 @@ static void gpo_sync_func(const char *mnt,
old_unix_dir = ctx->local_path;
ctx->local_path = talloc_strdup(ctx->mem_ctx, unix_dir);
- pstrcpy(ctx->mask, nt_dir);
- pstrcat(ctx->mask, "\\*");
-
+ ctx->mask = talloc_asprintf(ctx->mem_ctx,
+ "%s\\*",
+ nt_dir);
+ if (!ctx->local_path || !ctx->mask) {
+ DEBUG(0,("gpo_sync_func: ENOMEM\n"));
+ return;
+ }
if (!gpo_sync_files(ctx)) {
DEBUG(0,("could not sync files\n"));
}
@@ -219,8 +223,12 @@ NTSTATUS gpo_sync_directories(TALLOC_CTX *mem_ctx,
ctx.local_path = CONST_DISCARD(char *, local_path);
ctx.attribute = (aSYSTEM | aHIDDEN | aDIR);
- pstrcpy(ctx.mask, nt_path);
- pstrcat(ctx.mask, "\\*");
+ ctx.mask = talloc_asprintf(mem_ctx,
+ "%s\\*",
+ nt_path);
+ if (!ctx.mask) {
+ return NT_STATUS_NO_MEMORY;
+ }
if (!gpo_sync_files(&ctx)) {
return NT_STATUS_NO_SUCH_FILE;