From 41cead6a31ff7f5733103fd36711a25559edf43c Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 16 Jun 2010 17:28:34 +0200 Subject: s3:idmap_tdb2: move idmap_tdb2_alloc_load() up to reduce need for prototype --- source3/winbindd/idmap_tdb2.c | 71 +++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c index 979eb53790..f679553b45 100644 --- a/source3/winbindd/idmap_tdb2.c +++ b/source3/winbindd/idmap_tdb2.c @@ -51,42 +51,6 @@ static NTSTATUS idmap_tdb2_new_mapping(struct idmap_domain *dom, /* handle to the permanent tdb */ static struct db_context *idmap_tdb2; -static NTSTATUS idmap_tdb2_alloc_load(struct idmap_domain *dom); - -/* - open the permanent tdb - */ -static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom) -{ - char *db_path; - - if (idmap_tdb2) { - /* its already open */ - return NT_STATUS_OK; - } - - db_path = lp_parm_talloc_string(-1, "tdb", "idmap2.tdb", NULL); - if (db_path == NULL) { - /* fall back to the private directory, which, despite - its name, is usually on shared storage */ - db_path = talloc_asprintf(NULL, "%s/idmap2.tdb", lp_private_dir()); - } - NT_STATUS_HAVE_NO_MEMORY(db_path); - - /* Open idmap repository */ - idmap_tdb2 = db_open(NULL, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644); - TALLOC_FREE(db_path); - - if (idmap_tdb2 == NULL) { - DEBUG(0, ("Unable to open idmap_tdb2 database '%s'\n", - db_path)); - return NT_STATUS_UNSUCCESSFUL; - } - - /* load the ranges and high/low water marks */ - return idmap_tdb2_alloc_load(dom); -} - /* load the idmap allocation ranges and high/low water marks @@ -123,6 +87,41 @@ static NTSTATUS idmap_tdb2_alloc_load(struct idmap_domain *dom) } +/* + open the permanent tdb + */ +static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom) +{ + char *db_path; + + if (idmap_tdb2) { + /* its already open */ + return NT_STATUS_OK; + } + + db_path = lp_parm_talloc_string(-1, "tdb", "idmap2.tdb", NULL); + if (db_path == NULL) { + /* fall back to the private directory, which, despite + its name, is usually on shared storage */ + db_path = talloc_asprintf(NULL, "%s/idmap2.tdb", lp_private_dir()); + } + NT_STATUS_HAVE_NO_MEMORY(db_path); + + /* Open idmap repository */ + idmap_tdb2 = db_open(NULL, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644); + TALLOC_FREE(db_path); + + if (idmap_tdb2 == NULL) { + DEBUG(0, ("Unable to open idmap_tdb2 database '%s'\n", + db_path)); + return NT_STATUS_UNSUCCESSFUL; + } + + /* load the ranges and high/low water marks */ + return idmap_tdb2_alloc_load(dom); +} + + /* Allocate a new id. */ -- cgit