Author: metze Date: 2006-08-24 09:47:08 +0000 (Thu, 24 Aug 2006) New Revision: 17780
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17780 Log: better fix this one correctly metze Modified: branches/SAMBA_4_0/source/lib/samba3/idmap.c Changeset: Modified: branches/SAMBA_4_0/source/lib/samba3/idmap.c =================================================================== --- branches/SAMBA_4_0/source/lib/samba3/idmap.c 2006-08-24 09:41:45 UTC (rev 17779) +++ branches/SAMBA_4_0/source/lib/samba3/idmap.c 2006-08-24 09:47:08 UTC (rev 17780) @@ -34,9 +34,7 @@ #define HWM_USER "USER HWM" /* idmap version determines auto-conversion */ -#if 0 /* unused */ #define IDMAP_VERSION 2 -#endif /***************************************************************************** Initialise idmap database. @@ -46,6 +44,7 @@ { TDB_CONTEXT *tdb; TDB_DATA key, val; + int32_t version; /* Open idmap repository */ if (!(tdb = tdb_open(fn, 0, TDB_DEFAULT, O_RDONLY, 0644))) { @@ -58,6 +57,13 @@ idmap->user_hwm = tdb_fetch_int32(tdb, HWM_USER); idmap->group_hwm = tdb_fetch_int32(tdb, HWM_GROUP); + /* check against earlier versions */ + version = tdb_fetch_int32(tdb, "IDMAP_VERSION"); + if (version != IDMAP_VERSION) { + DEBUG(0, ("idmap_init: Unable to open idmap database, it's in an old format!\n")); + return NT_STATUS_INTERNAL_DB_ERROR; + } + for (key = tdb_firstkey(tdb); key.dptr; key = tdb_nextkey(tdb, key)) { struct samba3_idmap_mapping map;