summaryrefslogtreecommitdiff
path: root/source3/groupdb
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-01-09 05:24:07 +0000
committerJeremy Allison <jra@samba.org>2002-01-09 05:24:07 +0000
commita842a3d4582b556c77fcfb593af193b4d1225751 (patch)
tree564c3fd0f43329b651efb03b6f24a485b36cbc14 /source3/groupdb
parentabc6e70ca4824f7d7df5f4f68da4686018f9723c (diff)
downloadsamba-a842a3d4582b556c77fcfb593af193b4d1225751.tar.gz
samba-a842a3d4582b556c77fcfb593af193b4d1225751.tar.bz2
samba-a842a3d4582b556c77fcfb593af193b4d1225751.zip
When re-writing tdb version numbers as little endian int32, we must
change the version number also. Jeremy. (This used to be commit 3dec9cf99a82bd15626eb99e7d937ff00183cc05)
Diffstat (limited to 'source3/groupdb')
-rw-r--r--source3/groupdb/mapping.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source3/groupdb/mapping.c b/source3/groupdb/mapping.c
index 7093f14eca..e732f26c15 100644
--- a/source3/groupdb/mapping.c
+++ b/source3/groupdb/mapping.c
@@ -26,7 +26,9 @@ extern DOM_SID global_sam_sid;
static TDB_CONTEXT *tdb; /* used for driver files */
-#define DATABASE_VERSION 1
+#define DATABASE_VERSION_V1 1 /* native byte format. */
+#define DATABASE_VERSION_V2 2 /* le format. */
+
#define GROUP_PREFIX "UNIXGROUP/"
PRIVS privs[] = {
@@ -166,15 +168,15 @@ BOOL init_group_mapping(void)
/* Cope with byte-reversed older versions of the db. */
vers_id = tdb_fetch_int32(tdb, vstring);
- if ((vers_id != DATABASE_VERSION) && (IREV(vers_id) == DATABASE_VERSION)) {
+ if ((vers_id == DATABASE_VERSION_V1) || (IREV(vers_id) == DATABASE_VERSION_V1)) {
/* Written on a bigendian machine with old fetch_int code. Save as le. */
- tdb_store_int32(tdb, vstring, DATABASE_VERSION);
- vers_id = DATABASE_VERSION;
+ tdb_store_int32(tdb, vstring, DATABASE_VERSION_V2);
+ vers_id = DATABASE_VERSION_V2;
}
- if (vers_id != DATABASE_VERSION) {
+ if (vers_id != DATABASE_VERSION_V2) {
tdb_traverse(tdb, tdb_traverse_delete_fn, NULL);
- tdb_store_int32(tdb, vstring, DATABASE_VERSION);
+ tdb_store_int32(tdb, vstring, DATABASE_VERSION_V2);
}
tdb_unlock_bystring(tdb, vstring);