summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb.c
diff options
context:
space:
mode:
authorJan Zeleny <jzeleny@redhat.com>2011-05-03 05:21:17 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-05-04 10:46:55 -0400
commit9dfa22c3925792204b22962851dd44175e1b5735 (patch)
tree10c186c3e4da3df6a314fd5d29838b51fda9d20d /src/db/sysdb.c
parent772764e048dcd15c6d9732574126eb83b53a60e2 (diff)
downloadsssd-9dfa22c3925792204b22962851dd44175e1b5735.tar.gz
sssd-9dfa22c3925792204b22962851dd44175e1b5735.tar.xz
sssd-9dfa22c3925792204b22962851dd44175e1b5735.zip
Make sysdb_ctx_list public structure
Also create a routine to initialize it
Diffstat (limited to 'src/db/sysdb.c')
-rw-r--r--src/db/sysdb.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/db/sysdb.c b/src/db/sysdb.c
index 0e9779009..5396b7fc8 100644
--- a/src/db/sysdb.c
+++ b/src/db/sysdb.c
@@ -2013,6 +2013,47 @@ int sysdb_domain_init(TALLOC_CTX *mem_ctx,
db_path, false, _ctx);
}
+int sysdb_list_init(TALLOC_CTX *mem_ctx,
+ const char *path,
+ struct sysdb_ctx *ctx,
+ struct sysdb_ctx_list **_list)
+{
+ struct sysdb_ctx_list *list;
+ int ret;
+
+ list = talloc_zero(mem_ctx, struct sysdb_ctx_list);
+ if (!list) {
+ DEBUG(1, ("talloc_zero failed\n"));
+ return ENOMEM;
+ }
+
+ list->db_path = talloc_strdup(list, path);
+ if (!list->db_path) {
+ DEBUG(1, ("talloc_strdup failed\n"));
+ ret = ENOMEM;
+ goto fail;
+ }
+
+ if (ctx) {
+ list->num_dbs = 1;
+ list->dbs = talloc_array(list, struct sysdb_ctx *, list->num_dbs);
+ if (!list->dbs) {
+ DEBUG(1, ("talloc_array failed\n"));
+ ret = ENOMEM;
+ goto fail;
+ }
+
+ list->dbs[0] = talloc_steal(list, ctx);
+ }
+
+ *_list = list;
+ return EOK;
+
+fail:
+ talloc_free(list);
+ return ret;
+}
+
int sysdb_get_ctx_from_list(struct sysdb_ctx_list *ctx_list,
struct sss_domain_info *domain,
struct sysdb_ctx **ctx)