sssd/0011-DP-Load-override_space-into-be_ctx.patch
2017-09-01 21:34:35 +02:00

74 lines
2.6 KiB
Diff

From bac0c0df377de4469c8f9310179eef04c7b091fa Mon Sep 17 00:00:00 2001
From: Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Date: Fri, 24 Mar 2017 16:42:21 +0200
Subject: [PATCH 11/93] DP: Load override_space into be_ctx
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add loading and storing the override_space configuration option to data
provider. That will be needed for formatting output user and group names
for matching against session recording configuration.
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
---
src/providers/backend.h | 1 +
src/providers/data_provider_be.c | 22 ++++++++++++++++++++++
2 files changed, 23 insertions(+)
diff --git a/src/providers/backend.h b/src/providers/backend.h
index 42e80373d0413a994e9cacb897de261ff9d10c91..f6c74f8568bc776cbd670a7dfc95e6e1522a88be 100644
--- a/src/providers/backend.h
+++ b/src/providers/backend.h
@@ -84,6 +84,7 @@ struct be_ctx {
const char *conf_path;
uid_t uid;
gid_t gid;
+ char override_space;
struct session_recording_conf sr_conf;
struct be_failover_ctx *be_fo;
struct be_resolv_ctx *be_res;
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
index dbf78aa19bd20b470f1304a13fdb5923895f9664..376bdba7f0d3b55ecf84abae6280dac9b743b44c 100644
--- a/src/providers/data_provider_be.c
+++ b/src/providers/data_provider_be.c
@@ -377,6 +377,7 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx,
uint32_t refresh_interval;
struct tevent_signal *tes;
struct be_ctx *be_ctx;
+ char *str = NULL;
errno_t ret;
be_ctx = talloc_zero(mem_ctx, struct be_ctx);
@@ -428,6 +429,27 @@ errno_t be_process_init(TALLOC_CTX *mem_ctx,
goto done;
}
+ /* Read the global override_space option, for output name formatting */
+ ret = confdb_get_string(cdb, be_ctx, CONFDB_MONITOR_CONF_ENTRY,
+ CONFDB_MONITOR_OVERRIDE_SPACE, NULL,
+ &str);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_OP_FAILURE,
+ "Cannnot get the space substitution character [%d]: %s\n",
+ ret, strerror(ret));
+ goto done;
+ }
+
+ if (str != NULL) {
+ if (strlen(str) > 1) {
+ DEBUG(SSSDBG_MINOR_FAILURE, "Option %s is longer than 1 character "
+ "only the first character %c will be used\n",
+ CONFDB_MONITOR_OVERRIDE_SPACE, str[0]);
+ }
+
+ be_ctx->override_space = str[0];
+ }
+
/* Read session_recording section */
ret = session_recording_conf_load(be_ctx, cdb, &be_ctx->sr_conf);
if (ret != EOK) {
--
2.14.1