s3:idmap_tdb: add idmap domain arg to idmap_tdb_upgrade and use domain range
authorMichael Adam <obnox@samba.org>
Thu, 17 Jun 2010 07:46:08 +0000 (09:46 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 23 Jun 2010 10:22:12 +0000 (12:22 +0200)
source3/winbindd/idmap_tdb.c

index 35b318469e3b3755dc9db251ab2aea315464936b..1ff2631bf065c48bd267fbdc823b1ba5d35fb80c 100644 (file)
@@ -137,7 +137,7 @@ static int convert_fn(struct db_record *rec, void *private_data)
  Convert the idmap database from an older version.
 *****************************************************************************/
 
-static bool idmap_tdb_upgrade(struct db_context *db)
+static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
 {
        int32 vers;
        bool bigendianheader;
@@ -163,7 +163,7 @@ static bool idmap_tdb_upgrade(struct db_context *db)
                if (wm != -1) {
                        wm = IREV(wm);
                }  else {
-                       wm = idmap_tdb_state.low_uid;
+                       wm = dom->low_id;
                }
 
                if (dbwrap_store_int32(db, HWM_USER, wm) == -1) {
@@ -175,7 +175,7 @@ static bool idmap_tdb_upgrade(struct db_context *db)
                if (wm != -1) {
                        wm = IREV(wm);
                } else {
-                       wm = idmap_tdb_state.low_gid;
+                       wm = dom->low_id;
                }
 
                if (dbwrap_store_int32(db, HWM_GROUP, wm) == -1) {
@@ -294,7 +294,7 @@ static NTSTATUS idmap_tdb_open_db(TALLOC_CTX *memctx,
                        goto done;
                }
 
-               if (!idmap_tdb_upgrade(db)) {
+               if (!idmap_tdb_upgrade(dom, db)) {
                        db->transaction_cancel(db);
                        DEBUG(0, ("Unable to open idmap database, it's in an old format, and upgrade failed!\n"));
                        ret = NT_STATUS_INTERNAL_DB_ERROR;