summaryrefslogtreecommitdiffstats
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2014-03-21 00:04:15 +0100
committerJeremy Allison <jra@samba.org>2014-04-03 00:26:28 +0200
commit90d8e0f8bc6498fea7845a66280cdd0909dc3b81 (patch)
tree0baaa7ad44e52bb008a1b22cc237bb1e40488515 /source3
parent3aaaef40d570913c2bd156c91e1ef450d840a26b (diff)
downloadsamba-90d8e0f8bc6498fea7845a66280cdd0909dc3b81.tar.gz
samba-90d8e0f8bc6498fea7845a66280cdd0909dc3b81.tar.xz
samba-90d8e0f8bc6498fea7845a66280cdd0909dc3b81.zip
autorid: initialize: open the autorid db as late as possible.
But make sure to link the db context to commonconfig afterwards. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/winbindd/idmap_autorid.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/winbindd/idmap_autorid.c b/source3/winbindd/idmap_autorid.c
index e9b5d2ce3c..fcfdb2bb1e 100644
--- a/source3/winbindd/idmap_autorid.c
+++ b/source3/winbindd/idmap_autorid.c
@@ -613,13 +613,6 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
}
commonconfig->private_data = config;
- status = idmap_autorid_db_init(state_path("autorid.tdb"),
- NULL, /* TALLOC_CTX */
- &autorid_db);
- if (!NT_STATUS_IS_OK(status)) {
- goto error;
- }
-
config->minvalue = dom->low_id;
config->rangesize = lp_parm_int(-1, "idmap config *",
"rangesize", 100000);
@@ -651,13 +644,21 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
/* fill the TDB common configuration */
- commonconfig->db = autorid_db;
commonconfig->max_id = config->rangesize -1;
commonconfig->hwmkey_uid = ALLOC_HWM_UID;
commonconfig->hwmkey_gid = ALLOC_HWM_GID;
commonconfig->rw_ops->get_new_id = idmap_autorid_allocate_id;
commonconfig->rw_ops->set_mapping = idmap_tdb_common_set_mapping;
+ status = idmap_autorid_db_init(state_path("autorid.tdb"),
+ NULL, /* TALLOC_CTX */
+ &autorid_db);
+ if (!NT_STATUS_IS_OK(status)) {
+ goto error;
+ }
+
+ commonconfig->db = autorid_db;
+
status = idmap_autorid_saveconfig(autorid_db, config);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Failed to store configuration data!\n"));