Fix bug #6195 - Migrating from 3.0.x to 3.3.x can fail to update passdb.tdb correctly...
[ira/wip.git] / source3 / lib / dbwrap.c
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
  */