summaryrefslogtreecommitdiffstats
path: root/source3/libgpo/gpext/security.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2014-10-06 18:21:14 +0200
committerJeremy Allison <jra@samba.org>2014-10-06 19:18:05 +0200
commit3c592eaac6db32843cde480226424e71312a853f (patch)
tree815e45508f9b2c5e69c35d2af8b75bfe8c5ebd03 /source3/libgpo/gpext/security.c
parente8ee9bb66e765433e94f03d46ccb66459bb5fc3f (diff)
downloadsamba-3c592eaac6db32843cde480226424e71312a853f.tar.gz
samba-3c592eaac6db32843cde480226424e71312a853f.tar.xz
samba-3c592eaac6db32843cde480226424e71312a853f.zip
gpo: don't leak cache_path onto talloc tos
Also check for allocation failures. Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com> Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/libgpo/gpext/security.c')
-rw-r--r--source3/libgpo/gpext/security.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/source3/libgpo/gpext/security.c b/source3/libgpo/gpext/security.c
index 5360222ad2..2f461847b9 100644
--- a/source3/libgpo/gpext/security.c
+++ b/source3/libgpo/gpext/security.c
@@ -152,6 +152,10 @@ static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx,
char *unix_path = NULL;
struct gp_inifile_context *ini_ctx = NULL;
const struct GROUP_POLICY_OBJECT *gpo;
+ char *gpo_cache_path = cache_path(GPO_CACHE_DIR);
+ if (gpo_cache_path == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
/* implementation of the policy callback function, see
* http://msdn.microsoft.com/en-us/library/aa373494%28v=vs.85%29.aspx
@@ -172,7 +176,7 @@ static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx,
/* this handler processes the gpttmpl files and merge output to the
* registry */
- status = gpo_get_unix_path(mem_ctx, cache_path(GPO_CACHE_DIR),
+ status = gpo_get_unix_path(mem_ctx, gpo_cache_path,
gpo, &unix_path);
if (!NT_STATUS_IS_OK(status)) {
goto out;
@@ -198,6 +202,7 @@ static NTSTATUS security_process_group_policy(TALLOC_CTX *mem_ctx,
nt_errstr(status)));
}
TALLOC_FREE(ini_ctx);
+ talloc_free(gpo_cache_path);
return status;
}