diff options
author | Michael Adam <obnox@samba.org> | 2010-06-16 17:28:34 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-08-14 02:10:45 +0200 |
commit | 41cead6a31ff7f5733103fd36711a25559edf43c (patch) | |
tree | 025d3441a41cc72a32693efa5b845c588e942a96 /source3/winbindd | |
parent | 2c549be359152964f9126530664e24bedd75f6f5 (diff) | |
download | samba-41cead6a31ff7f5733103fd36711a25559edf43c.tar.gz samba-41cead6a31ff7f5733103fd36711a25559edf43c.tar.bz2 samba-41cead6a31ff7f5733103fd36711a25559edf43c.zip |
s3:idmap_tdb2: move idmap_tdb2_alloc_load() up to reduce need for prototype
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/idmap_tdb2.c | 71 |
1 files 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 @@ -124,6 +88,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. */ |