summaryrefslogtreecommitdiff
path: root/source3/libgpo
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
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')
-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;