svn commit: samba r18868 - in branches/SAMBA_3_0/source/groupdb: .

tridge at samba.org tridge at samba.org
Sun Sep 24 02:58:58 GMT 2006


Author: tridge
Date: 2006-09-24 02:58:58 +0000 (Sun, 24 Sep 2006)
New Revision: 18868

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18868

Log:

just in case there is a disaster (with our code? never ...) use a
rename to group_mapping.tdb.upgraded rather than an unlink when
upgrading. So if we absolutely have to go back to the tdb, we can
change mapping_ldb.o to mapping_tdb.o in Makefile.in and recover
peoples group mappings.

We could go one step futher and make the backend configurable. Any
opinions on that?

Modified:
   branches/SAMBA_3_0/source/groupdb/mapping_ldb.c


Changeset:
Modified: branches/SAMBA_3_0/source/groupdb/mapping_ldb.c
===================================================================
--- branches/SAMBA_3_0/source/groupdb/mapping_ldb.c	2006-09-24 02:52:25 UTC (rev 18867)
+++ branches/SAMBA_3_0/source/groupdb/mapping_ldb.c	2006-09-24 02:58:58 UTC (rev 18868)
@@ -643,6 +643,8 @@
 {
 	static TDB_CONTEXT *tdb;
 	int ret, status=0;
+	pstring old_path;
+	pstring new_path;
 
 	tdb = tdb_open_log(tdb_path, 0, TDB_DEFAULT, O_RDWR, 0600);
 	if (tdb == NULL) goto failed;
@@ -657,8 +659,11 @@
 
 	if (tdb) tdb_close(tdb);
 
-	if (unlink(tdb_path) != 0) {
-		DEBUG(0,("Failed to delete old group mapping database\n"));
+	pstrcpy(old_path, tdb_path);
+	pstrcpy(new_path, lock_path("group_mapping.tdb.upgraded"));
+
+	if (rename(old_path, new_path) != 0) {
+		DEBUG(0,("Failed to rename old group mapping database\n"));
 		goto failed;
 	}
 	return True;



More information about the samba-cvs mailing list