summaryrefslogtreecommitdiffstats
path: root/server/confdb
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-11-03 17:18:49 -0500
committerSimo Sorce <idra@samba.org>2008-11-03 17:18:49 -0500
commita2c6e0e0beb75e0a8fa7e3e07e9443d97ea2b731 (patch)
treec59aa17b7b63327d1a63561586ab7ba4ea70edf0 /server/confdb
parentddbc682f58bcee78ac1dbd24b3c44da67512d888 (diff)
Add support for dbus comunication in the nss service
Add utility function in confdb Make all component fetch the dbus socket from the confdb
Diffstat (limited to 'server/confdb')
-rw-r--r--server/confdb/confdb.c34
-rw-r--r--server/confdb/confdb.h4
2 files changed, 38 insertions, 0 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index 18b369ca..1dd79982 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -282,6 +282,40 @@ done:
return ret;
}
+int confdb_get_string(struct confdb_ctx *cdb, TALLOC_CTX *ctx,
+ const char *section, const char *attribute,
+ const char *defstr, char **result)
+{
+ char **values;
+ char *restr;
+ int ret;
+
+ ret = confdb_get_param(cdb, ctx, section, attribute, &values);
+ if (ret != EOK) {
+ return ret;
+ }
+
+ if (values[0]) {
+ if (values[1] != NULL) {
+ /* too many values */
+ talloc_free(values);
+ return EINVAL;
+ }
+ restr = talloc_steal(ctx, values[0]);
+ } else {
+ restr = talloc_strdup(ctx, defstr);
+ }
+ if (!restr) {
+ talloc_free(values);
+ return ENOMEM;
+ }
+
+ talloc_free(values);
+
+ *result = restr;
+ return EOK;
+}
+
static int confdb_test(struct confdb_ctx *cdb)
{
char **values;
diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h
index 8becdf99..b8b68531 100644
--- a/server/confdb/confdb.h
+++ b/server/confdb/confdb.h
@@ -34,6 +34,10 @@ int confdb_get_param(struct confdb_ctx *cdb,
const char *attribute,
char ***values);
+int confdb_get_string(struct confdb_ctx *cdb, TALLOC_CTX *ctx,
+ const char *section, const char *attribute,
+ const char *defstr, char **result);
+
int confdb_init(TALLOC_CTX *mem_ctx,
struct event_context *ev,
struct confdb_ctx **cdb_ctx);