diff options
Diffstat (limited to 'source3/lib/dbwrap/dbwrap_open.c')
-rw-r--r-- | source3/lib/dbwrap/dbwrap_open.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index d6b2f30ef6..8721b1b0f9 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -27,6 +27,33 @@ #include "ctdb_private.h" #endif +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 */ |