summaryrefslogtreecommitdiffstats
path: root/libgpo
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2013-12-11 00:44:49 +0100
committerAndreas Schneider <asn@samba.org>2013-12-12 13:34:51 +0100
commit12c7b9498c02e75440e3923cdc4b8c6e03f8afd8 (patch)
treeb9982993f679543a2dc31cbc4795a7f07f079068 /libgpo
parentc329a6abcc236101665d2453a70375d740b73944 (diff)
downloadsamba-12c7b9498c02e75440e3923cdc4b8c6e03f8afd8.tar.gz
samba-12c7b9498c02e75440e3923cdc4b8c6e03f8afd8.tar.xz
samba-12c7b9498c02e75440e3923cdc4b8c6e03f8afd8.zip
libgpo: add gp_inifile_getbool().
Guenther Signed-off-by: Günther Deschner <gd@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'libgpo')
-rw-r--r--libgpo/gpo_ini.c24
-rw-r--r--libgpo/gpo_ini.h1
2 files changed, 25 insertions, 0 deletions
diff --git a/libgpo/gpo_ini.c b/libgpo/gpo_ini.c
index a2cb106d73c..1f69eecc42e 100644
--- a/libgpo/gpo_ini.c
+++ b/libgpo/gpo_ini.c
@@ -165,6 +165,30 @@ NTSTATUS gp_inifile_getint(struct gp_inifile_context *ctx, const char *key, int
/****************************************************************
****************************************************************/
+NTSTATUS gp_inifile_getbool(struct gp_inifile_context *ctx, const char *key, bool *ret)
+{
+ char *value;
+ NTSTATUS result;
+
+ result = gp_inifile_getstring(ctx,key, &value);
+ if (!NT_STATUS_IS_OK(result)) {
+ return result;
+ }
+
+ if (strequal(value, "Yes")) {
+ *ret = true;
+ return NT_STATUS_OK;
+ } else if (strequal(value, "No")) {
+ *ret = false;
+ return NT_STATUS_OK;
+ }
+
+ return NT_STATUS_NOT_FOUND;
+}
+
+/****************************************************************
+****************************************************************/
+
NTSTATUS gp_inifile_init_context(TALLOC_CTX *mem_ctx,
uint32_t flags,
const char *unix_path,
diff --git a/libgpo/gpo_ini.h b/libgpo/gpo_ini.h
index 1f3fa56d32c..c9afec09784 100644
--- a/libgpo/gpo_ini.h
+++ b/libgpo/gpo_ini.h
@@ -42,4 +42,5 @@ NTSTATUS parse_gpt_ini(TALLOC_CTX *ctx,
char **display_name);
NTSTATUS gp_inifile_getstring(struct gp_inifile_context *ctx, const char *key, char **ret);
NTSTATUS gp_inifile_getint(struct gp_inifile_context *ctx, const char *key, int *ret);
+NTSTATUS gp_inifile_getbool(struct gp_inifile_context *ctx, const char *key, bool *ret);