From 3ede5abce41961cb5a18328a12f3bb73a76103b1 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 14 Apr 2009 10:22:20 -0400 Subject: [PATCH] Make reconnection to the Data Provider a global setting Previously, every DP client was allowed to set its own "retries" option. This option was ambiguous, and useless. All DP clients will now use a global option set in the DP config called "reconnection_retries" --- server/examples/sssd.conf | 3 +++ server/providers/data_provider.c | 2 -- server/providers/data_provider.h | 1 + server/providers/data_provider_be.c | 4 ++-- server/responder/nss/nsssrv.c | 7 ++----- server/responder/pam/pamsrv.c | 4 ++-- 6 files changed, 10 insertions(+), 11 deletions(-) diff --git a/server/examples/sssd.conf b/server/examples/sssd.conf index b9a421e..fbf3e9b 100644 --- a/server/examples/sssd.conf +++ b/server/examples/sssd.conf @@ -12,6 +12,9 @@ filterUsers = root [services/dp] description = Data Provider Configuration +# Number of times Data Provider clients should attempt to reconnect in the +# event of a Data Provider crash or restart before they give up +reconnection_retries = 3 [services/pam] description = PAM Responder Configuration diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c index e8f190e..2b06add 100644 --- a/server/providers/data_provider.c +++ b/server/providers/data_provider.c @@ -42,8 +42,6 @@ #include "monitor/monitor_sbus.h" #include "monitor/monitor_interfaces.h" -#define DP_CONF_ENTRY "config/services/dp" - struct dp_backend; struct dp_frontend; diff --git a/server/providers/data_provider.h b/server/providers/data_provider.h index 2c828fa..3d06b5c 100644 --- a/server/providers/data_provider.h +++ b/server/providers/data_provider.h @@ -42,6 +42,7 @@ #define DATA_PROVIDER_DB_FILE "sssd.ldb" #define DATA_PROVIDER_DB_CONF_SEC "config/services/nss" +#define DP_CONF_ENTRY "config/services/dp" #define MOD_OFFLINE 0x0000 #define MOD_ONLINE 0x0001 diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c index 3d824c3..c8576fe 100644 --- a/server/providers/data_provider_be.c +++ b/server/providers/data_provider_be.c @@ -681,8 +681,8 @@ static int be_cli_init(struct be_ctx *ctx) } /* Enable automatic reconnection to the Data Provider */ - ret = confdb_get_int(ctx->cdb, ctx, ctx->conf_path, - "retries", 3, &max_retries); + ret = confdb_get_int(ctx->cdb, ctx, DP_CONF_ENTRY, + "reconnection_retries", 3, &max_retries); if (ret != EOK) { DEBUG(0, ("Failed to set up automatic reconnection\n")); return ret; diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c index 8e72a95..f94ba3f 100644 --- a/server/responder/nss/nsssrv.c +++ b/server/responder/nss/nsssrv.c @@ -297,12 +297,9 @@ int nss_process_init(TALLOC_CTX *mem_ctx, } /* Enable automatic reconnection to the Data Provider */ - - /* FIXME: "retries" is too generic, either get it from a global config - * or specify these retries are about the sbus connections to DP */ ret = confdb_get_int(nctx->rctx->cdb, nctx->rctx, - nctx->rctx->confdb_service_path, - "retries", 3, &max_retries); + DP_CONF_ENTRY, + "reconnection_retries", 3, &max_retries); if (ret != EOK) { DEBUG(0, ("Failed to set up automatic reconnection\n")); return ret; diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c index 1adbb14..4b8214f 100644 --- a/server/responder/pam/pamsrv.c +++ b/server/responder/pam/pamsrv.c @@ -163,8 +163,8 @@ static int pam_process_init(struct main_context *main_ctx, /* FIXME: "retries" is too generic, either get it from a global config * or specify these retries are about the sbus connections to DP */ - ret = confdb_get_int(rctx->cdb, rctx, rctx->confdb_service_path, - "retries", 3, &max_retries); + ret = confdb_get_int(rctx->cdb, rctx, DP_CONF_ENTRY, + "reconnection_retries", 3, &max_retries); if (ret != EOK) { DEBUG(0, ("Failed to set up automatic reconnection\n")); return ret; -- 1.6.0.6