diff options
author | Simo Sorce <idra@samba.org> | 2009-02-13 14:17:24 -0500 |
---|---|---|
committer | Simo Sorce <idra@samba.org> | 2009-02-13 14:17:24 -0500 |
commit | 224a0dfad69c2e056f19e2b4865d592f495fb944 (patch) | |
tree | 7a3e266a11ad9f8f6279592dad1d5ee8b901bd0b /server/confdb | |
parent | b794a3bae0ed6b8ce7e0762a36f0e58d8f8d8776 (diff) | |
download | sssd-224a0dfad69c2e056f19e2b4865d592f495fb944.tar.gz sssd-224a0dfad69c2e056f19e2b4865d592f495fb944.tar.bz2 sssd-224a0dfad69c2e056f19e2b4865d592f495fb944.zip |
Always pass teh database path explicitly, so that test cases can use
throw away databases
Check version and init main db if empty
Diffstat (limited to 'server/confdb')
-rw-r--r-- | server/confdb/confdb.c | 15 | ||||
-rw-r--r-- | server/confdb/confdb.h | 5 |
2 files changed, 7 insertions, 13 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c index 945ac2b8..28f25176 100644 --- a/server/confdb/confdb.c +++ b/server/confdb/confdb.c @@ -26,8 +26,8 @@ #include "ldb.h" #include "ldb_errors.h" #include "util/util.h" +#include "confdb/confdb.h" #define CONFDB_VERSION "0.1" -#define CONFDB_FILE "config.ldb" #define CONFDB_DOMAIN_BASEDN "cn=domains,cn=config" #define CONFDB_DOMAIN_ATTR "cn" @@ -530,10 +530,10 @@ done: int confdb_init(TALLOC_CTX *mem_ctx, struct event_context *ev, - struct confdb_ctx **cdb_ctx) + struct confdb_ctx **cdb_ctx, + char *confdb_location) { struct confdb_ctx *cdb; - char *confdb_location; int ret; cdb = talloc_zero(mem_ctx, struct confdb_ctx); @@ -546,21 +546,12 @@ int confdb_init(TALLOC_CTX *mem_ctx, return EIO; } - confdb_location = talloc_asprintf(cdb,"%s/%s", DB_PATH,CONFDB_FILE); - if (confdb_location == NULL) { - talloc_free(cdb); - return ENOMEM; - } - DEBUG(3, ("CONFDB: %s\n",confdb_location)); - ret = ldb_connect(cdb->ldb, confdb_location, 0, NULL); if (ret != LDB_SUCCESS) { talloc_free(cdb); return EIO; } - talloc_free(confdb_location); - ret = confdb_test(cdb); if (ret == ENOENT) { ret = confdb_init_db(cdb); diff --git a/server/confdb/confdb.h b/server/confdb/confdb.h index 62ab45c7..e6dd0d47 100644 --- a/server/confdb/confdb.h +++ b/server/confdb/confdb.h @@ -19,6 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define CONFDB_FILE "config.ldb" + struct confdb_ctx; int confdb_add_param(struct confdb_ctx *cdb, @@ -44,7 +46,8 @@ int confdb_get_int(struct confdb_ctx *cdb, TALLOC_CTX *ctx, int confdb_init(TALLOC_CTX *mem_ctx, struct event_context *ev, - struct confdb_ctx **cdb_ctx); + struct confdb_ctx **cdb_ctx, + char *confdb_location); int confdb_get_domains(struct confdb_ctx *cdb, TALLOC_CTX *mem_ctx, |