summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-08-24 09:47:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:16:41 -0500
commite996cd557190b22149719bb0e9e77b95029d51b8 (patch)
tree417fff165fd3498b3fab71da49e8a5989a234965
parentbca791da85d7b82636fb4e94c5466711ab17af74 (diff)
downloadsamba-e996cd557190b22149719bb0e9e77b95029d51b8.tar.gz
samba-e996cd557190b22149719bb0e9e77b95029d51b8.tar.bz2
samba-e996cd557190b22149719bb0e9e77b95029d51b8.zip
r17780: better fix this one correctly
metze (This used to be commit fbdc5c635606490618ecd54f1b49db70e680cf05)
-rw-r--r--source4/lib/samba3/idmap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source4/lib/samba3/idmap.c b/source4/lib/samba3/idmap.c
index 4521ae72b3..334accc2aa 100644
--- a/source4/lib/samba3/idmap.c
+++ b/source4/lib/samba3/idmap.c
@@ -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 @@ NTSTATUS samba3_read_idmap(const char *fn, TALLOC_CTX *ctx, struct samba3_idmapd
{
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 @@ NTSTATUS samba3_read_idmap(const char *fn, TALLOC_CTX *ctx, struct samba3_idmapd
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;