summaryrefslogtreecommitdiff
path: root/libgpo
diff options
context:
space:
mode:
authorWilco Baan Hofman <wilco@baanhofman.nl>2009-04-20 16:51:33 +0200
committerGünther Deschner <gd@samba.org>2009-04-20 23:16:17 +0200
commit171a361375e1cd76a80253d67e4e34a139bb5570 (patch)
tree50f01eb72412462dd69ce0b17ccc99834b4d3d01 /libgpo
parent933482e64869f5aee2ca0356abb721facfd65943 (diff)
downloadsamba-171a361375e1cd76a80253d67e4e34a139bb5570.tar.gz
samba-171a361375e1cd76a80253d67e4e34a139bb5570.tar.bz2
samba-171a361375e1cd76a80253d67e4e34a139bb5570.zip
Fix ini parsing in the s3 gpext modules. Fix ini parser API. Make the build work
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'libgpo')
-rw-r--r--libgpo/config.mk3
-rw-r--r--libgpo/gpo_fetch.c1
-rw-r--r--libgpo/gpo_ini.c19
-rw-r--r--libgpo/gpo_ini.h2
4 files changed, 19 insertions, 6 deletions
diff --git a/libgpo/config.mk b/libgpo/config.mk
index a9ad76c964..6472d16191 100644
--- a/libgpo/config.mk
+++ b/libgpo/config.mk
@@ -2,5 +2,6 @@
PRIVATE_DEPENDENCIES = LIBLDB LIBSAMBA-NET
LIBGPO_OBJ_FILES = ../libgpo/gpo_util.o ../libgpo/gpo_sec.o \
- ../libgpo/gpext/gpext.o ../libgpo/gpo_fetch.o \
+ ../libgpo/gpext/gpext.o \
+ ../libgpo/gpo_fetch.o ../libgpo/gpo_ini.o \
$(libgpodir)/ads_convenience.o $(libgpodir)/gpo_filesync.o
diff --git a/libgpo/gpo_fetch.c b/libgpo/gpo_fetch.c
index a5714f7243..beedfc2280 100644
--- a/libgpo/gpo_fetch.c
+++ b/libgpo/gpo_fetch.c
@@ -20,6 +20,7 @@
#include "includes.h"
#include "system/filesys.h"
#include "../libgpo/gpo.h"
+#include "../libgpo/gpo_ini.h"
#if _SAMBA_BUILD_ == 4
#include "param/param.h"
diff --git a/libgpo/gpo_ini.c b/libgpo/gpo_ini.c
index 79bf5fd8d8..af2b88c0b8 100644
--- a/libgpo/gpo_ini.c
+++ b/libgpo/gpo_ini.c
@@ -169,6 +169,7 @@ NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx,
{
struct gp_inifile_context *ctx = NULL;
NTSTATUS status;
+ int rv;
char *tmp_filename = NULL;
const char *ini_filename = NULL;
@@ -192,6 +193,12 @@ NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx,
goto failed;
}
+ rv = pm_process(tmp_filename, change_section, store_keyval_pair, ctx);
+ if (!rv) {
+ return NT_STATUS_NO_SUCH_FILE;
+ }
+
+
ctx->generated_filename = tmp_filename;
ctx->mem_ctx = mem_ctx;
@@ -217,7 +224,7 @@ NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx,
#define GPT_INI_PARAMETER_VERSION "Version"
#define GPT_INI_PARAMETER_DISPLAYNAME "displayName"
-NTSTATUS parse_gpt_ini(struct gp_inifile_context *ctx,
+NTSTATUS parse_gpt_ini(TALLOC_CTX *mem_ctx,
const char *filename,
uint32_t *version,
char **display_name)
@@ -226,12 +233,16 @@ NTSTATUS parse_gpt_ini(struct gp_inifile_context *ctx,
int rv;
int v = 0;
char *name = NULL;
+ struct gp_inifile_context *ctx;
if (!filename) {
return NT_STATUS_INVALID_PARAMETER;
}
- rv = pm_process(filename, change_section, store_keyval_pair, NULL);
+ ctx = talloc_zero(mem_ctx, struct gp_inifile_context);
+ NT_STATUS_HAVE_NO_MEMORY(ctx);
+
+ rv = pm_process(filename, change_section, store_keyval_pair, ctx);
if (!rv) {
return NT_STATUS_NO_SUCH_FILE;
}
@@ -263,7 +274,7 @@ NTSTATUS parse_gpt_ini(struct gp_inifile_context *ctx,
*version = v;
}
- result = NT_STATUS_OK;
+ talloc_free(ctx);
- return result;
+ return NT_STATUS_OK;
}
diff --git a/libgpo/gpo_ini.h b/libgpo/gpo_ini.h
index 20588b6664..02ca0ff9ad 100644
--- a/libgpo/gpo_ini.h
+++ b/libgpo/gpo_ini.h
@@ -36,7 +36,7 @@ NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx, uint32_t flags,
const char *unix_path, const char *suffix,
struct gp_inifile_context **ctx_ret);
-NTSTATUS parse_gpt_ini(struct gp_inifile_context *ctx,
+NTSTATUS parse_gpt_ini(TALLOC_CTX *ctx,
const char *filename,
uint32_t *version,
char **display_name);