summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-10-20 23:52:02 +0200
committerMichael Adam <obnox@samba.org>2008-10-27 13:02:38 +0100
commit9299d53ef95a72f10d3ccde175ae5c90d2c95333 (patch)
tree6929032dbab324ef84d7454bfd038e4ad5660ae8
parent0ee8992331ea52e3be64a21f87a3495fe22c4112 (diff)
downloadsamba-9299d53ef95a72f10d3ccde175ae5c90d2c95333.tar.gz
samba-9299d53ef95a72f10d3ccde175ae5c90d2c95333.tar.bz2
samba-9299d53ef95a72f10d3ccde175ae5c90d2c95333.zip
[s3]libsmbconf: add backend_requires_messaging() method to libsmbconf.
In a clustered environment, the registry backend needs messaging to be set up since ctdb requires this. Michael
-rw-r--r--source3/lib/smbconf/smbconf.c9
-rw-r--r--source3/lib/smbconf/smbconf.h1
-rw-r--r--source3/lib/smbconf/smbconf_private.h1
-rw-r--r--source3/lib/smbconf/smbconf_reg.c11
-rw-r--r--source3/lib/smbconf/smbconf_txt.c6
5 files changed, 28 insertions, 0 deletions
diff --git a/source3/lib/smbconf/smbconf.c b/source3/lib/smbconf/smbconf.c
index 77a438048f..f0188380a0 100644
--- a/source3/lib/smbconf/smbconf.c
+++ b/source3/lib/smbconf/smbconf.c
@@ -43,6 +43,15 @@ static WERROR smbconf_global_check(struct smbconf_ctx *ctx)
**********************************************************************/
/**
+ * Tell whether the backend requires messaging to be set up
+ * for the backend to work correctly.
+ */
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx)
+{
+ return ctx->ops->requires_messaging(ctx);
+}
+
+/**
* Close the configuration.
*/
void smbconf_shutdown(struct smbconf_ctx *ctx)
diff --git a/source3/lib/smbconf/smbconf.h b/source3/lib/smbconf/smbconf.h
index e337476665..3f3435ea00 100644
--- a/source3/lib/smbconf/smbconf.h
+++ b/source3/lib/smbconf/smbconf.h
@@ -56,6 +56,7 @@ WERROR smbconf_init_txt(TALLOC_CTX *mem_ctx,
/*
* the smbconf API functions
*/
+bool smbconf_backend_requires_messaging(struct smbconf_ctx *ctx);
void smbconf_shutdown(struct smbconf_ctx *ctx);
bool smbconf_changed(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
const char *service, const char *param);
diff --git a/source3/lib/smbconf/smbconf_private.h b/source3/lib/smbconf/smbconf_private.h
index 8e7d6a9983..a47d81fa25 100644
--- a/source3/lib/smbconf/smbconf_private.h
+++ b/source3/lib/smbconf/smbconf_private.h
@@ -23,6 +23,7 @@
struct smbconf_ops {
WERROR (*init)(struct smbconf_ctx *ctx, const char *path);
int (*shutdown)(struct smbconf_ctx *ctx);
+ bool (*requires_messaging)(struct smbconf_ctx *ctx);
WERROR (*open_conf)(struct smbconf_ctx *ctx);
int (*close_conf)(struct smbconf_ctx *ctx);
void (*get_csn)(struct smbconf_ctx *ctx, struct smbconf_csn *csn,
diff --git a/source3/lib/smbconf/smbconf_reg.c b/source3/lib/smbconf/smbconf_reg.c
index 1aa345da3c..6edb9ed22e 100644
--- a/source3/lib/smbconf/smbconf_reg.c
+++ b/source3/lib/smbconf/smbconf_reg.c
@@ -642,6 +642,16 @@ static int smbconf_reg_shutdown(struct smbconf_ctx *ctx)
return ctx->ops->close_conf(ctx);
}
+static bool smbconf_reg_requires_messaging(struct smbconf_ctx *ctx)
+{
+#ifdef CLUSTER_SUPPORT
+ if (lp_clustering() && lp_parm_bool(-1, "ctdb", "registry.tdb", true)) {
+ return true;
+ }
+#endif
+ return false;
+}
+
static WERROR smbconf_reg_open(struct smbconf_ctx *ctx)
{
WERROR werr;
@@ -1119,6 +1129,7 @@ done:
struct smbconf_ops smbconf_ops_reg = {
.init = smbconf_reg_init,
.shutdown = smbconf_reg_shutdown,
+ .requires_messaging = smbconf_reg_requires_messaging,
.open_conf = smbconf_reg_open,
.close_conf = smbconf_reg_close,
.get_csn = smbconf_reg_get_csn,
diff --git a/source3/lib/smbconf/smbconf_txt.c b/source3/lib/smbconf/smbconf_txt.c
index 1393a098d5..7661c0dceb 100644
--- a/source3/lib/smbconf/smbconf_txt.c
+++ b/source3/lib/smbconf/smbconf_txt.c
@@ -243,6 +243,11 @@ static int smbconf_txt_shutdown(struct smbconf_ctx *ctx)
return ctx->ops->close_conf(ctx);
}
+static bool smbconf_txt_requires_messaging(struct smbconf_ctx *ctx)
+{
+ return false;
+}
+
static WERROR smbconf_txt_open(struct smbconf_ctx *ctx)
{
return smbconf_txt_load_file(ctx);
@@ -604,6 +609,7 @@ static WERROR smbconf_txt_delete_includes(struct smbconf_ctx *ctx,
static struct smbconf_ops smbconf_ops_txt = {
.init = smbconf_txt_init,
.shutdown = smbconf_txt_shutdown,
+ .requires_messaging = smbconf_txt_requires_messaging,
.open_conf = smbconf_txt_open,
.close_conf = smbconf_txt_close,
.get_csn = smbconf_txt_get_csn,