autorid: initialize: use the split db_open and init_hwms function instead of db_init
authorMichael Adam <obnox@samba.org>
Thu, 20 Mar 2014 23:07:07 +0000 (00:07 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 2 Apr 2014 22:26:28 +0000 (00:26 +0200)
This way, we can later put all of the storing functions inside one transaction.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/idmap_autorid.c

index fcfdb2bb1e856dbd1b116d0d353f07249e36aec7..ec12278388df2d9b9c9f0d22b7709fe8f69408e0 100644 (file)
@@ -650,7 +650,7 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
        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"),
+       status = idmap_autorid_db_open(state_path("autorid.tdb"),
                                       NULL, /* TALLOC_CTX */
                                       &autorid_db);
        if (!NT_STATUS_IS_OK(status)) {
@@ -659,6 +659,11 @@ static NTSTATUS idmap_autorid_initialize(struct idmap_domain *dom)
 
        commonconfig->db = autorid_db;
 
+       status = idmap_autorid_init_hwms(autorid_db);
+       if (!NT_STATUS_IS_OK(status)) {
+               goto error;
+       }
+
        status = idmap_autorid_saveconfig(autorid_db, config);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(1, ("Failed to store configuration data!\n"));