summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/dbwrap.h2
-rw-r--r--source3/lib/dbwrap.c27
-rw-r--r--source3/passdb/pdb_tdb.c3
3 files changed, 31 insertions, 1 deletions
diff --git a/source3/include/dbwrap.h b/source3/include/dbwrap.h
index 16f10cc125..1803587c4a 100644
--- a/source3/include/dbwrap.h
+++ b/source3/include/dbwrap.h
@@ -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,
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 5e7ce6099f..67c08a6085 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -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
*/
diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c
index 73fcfee4b3..fb40b27476 100644
--- a/source3/passdb/pdb_tdb.c
+++ b/source3/passdb/pdb_tdb.c
@@ -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;
}