Fix bug #6195 - Migrating from 3.0.x to 3.3.x can fail to update passdb.tdb correctly...
authorJeremy Allison <jra@samba.org>
Fri, 27 Mar 2009 19:12:30 +0000 (12:12 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 27 Mar 2009 19:13:13 +0000 (12:13 -0700)
Clustered setups should have only ever used
the unsigned version of TDB_DATA in the
first place so they can't be in this mess :-).
Just do the normal upgrade in the clustered case.
Jeremy.

source3/include/dbwrap.h
source3/lib/dbwrap.c
source3/passdb/pdb_tdb.c

index 16f10cc1252d3a9ab2a4d2bb7b0a2cff1242ea77..1803587c4aca12ac7ea4f8041614f0d28605e6f9 100644 (file)
@@ -54,6 +54,8 @@ struct db_context {
        bool persistent;
 };
 
+bool db_is_local(const char *name);
+
 struct db_context *db_open(TALLOC_CTX *mem_ctx,
                           const char *name,
                           int hash_size, int tdb_flags,
index 5e7ce6099fc486004d737304f01e784639379675..67c08a6085f659f49de367383add8e8065c26765 100644 (file)
@@ -65,6 +65,33 @@ static int dbwrap_fallback_parse_record(struct db_context *db, TDB_DATA key,
        return res;
 }
 
+bool db_is_local(const char *name)
+{
+#ifdef CLUSTER_SUPPORT
+       const char *sockname = lp_ctdbd_socket();
+
+       if(!sockname || !*sockname) {
+               sockname = CTDB_PATH;
+       }
+
+       if (lp_clustering() && socket_exist(sockname)) {
+               const char *partname;
+               /* ctdb only wants the file part of the name */
+               partname = strrchr(name, '/');
+               if (partname) {
+                       partname++;
+               } else {
+                       partname = name;
+               }
+               /* allow ctdb for individual databases to be disabled */
+               if (lp_parm_bool(-1, "ctdb", partname, True)) {
+                       return false;
+               }
+       }
+#endif
+       return true;
+}
+
 /**
  * open a database
  */
index 73fcfee4b35304dfeca5a668772e16eaf9b1f96f..fb40b274765bed2348d6c549f22b15525cbdcd59 100644 (file)
@@ -322,7 +322,8 @@ static bool tdbsam_convert(struct db_context **pp_db, const char *name, int32 fr
        struct db_context *db = NULL;
        int ret;
 
-       if (!tdbsam_convert_backup(name, pp_db)) {
+       /* We only need the update backup for local db's. */
+       if (db_is_local(name) && !tdbsam_convert_backup(name, pp_db)) {
                DEBUG(0, ("tdbsam_convert: Could not backup %s\n", name));
                return false;
        }