summaryrefslogtreecommitdiff
path: root/source3/libgpo/gpo_filesync.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-11-15 18:27:26 -0800
committerJeremy Allison <jra@samba.org>2007-11-15 18:27:26 -0800
commitacb829ecc3b9af3f141425ecac032a7c722a1815 (patch)
treeb5f4f9d8d89096859509b419894ac68c6b62f029 /source3/libgpo/gpo_filesync.c
parentc261545449f71d9b347a37518dab0d5ae4116f8b (diff)
downloadsamba-acb829ecc3b9af3f141425ecac032a7c722a1815.tar.gz
samba-acb829ecc3b9af3f141425ecac032a7c722a1815.tar.bz2
samba-acb829ecc3b9af3f141425ecac032a7c722a1815.zip
Add MAX_DNS_NAME_LENGTH, remove more pstrings.
Jeremy. (This used to be commit a1725f4ff7ed375808c78ac661b539557748d0a5)
Diffstat (limited to 'source3/libgpo/gpo_filesync.c')
-rw-r--r--source3/libgpo/gpo_filesync.c20
1 files changed, 14 insertions, 6 deletions
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;