|
|
8d3578 |
From 44e76055d4413e56a33a90185161b6cfa4062d03 Mon Sep 17 00:00:00 2001
|
|
|
8d3578 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
8d3578 |
Date: Thu, 26 Sep 2019 20:24:34 +0200
|
|
|
8d3578 |
Subject: [PATCH 106/109] ad: allow booleans for ad_inherit_opts_if_needed()
|
|
|
8d3578 |
MIME-Version: 1.0
|
|
|
8d3578 |
Content-Type: text/plain; charset=UTF-8
|
|
|
8d3578 |
Content-Transfer-Encoding: 8bit
|
|
|
8d3578 |
|
|
|
8d3578 |
Currently ad_inherit_opts_if_needed() can only handle strings. With this
|
|
|
8d3578 |
patch it can handle boolean options as well.
|
|
|
8d3578 |
|
|
|
8d3578 |
Related to https://pagure.io/SSSD/sssd/issue/4131
|
|
|
8d3578 |
|
|
|
8d3578 |
(cherry picked from commit 3dadb248440f2e7a02c68049001f848459dd1bdf)
|
|
|
8d3578 |
|
|
|
8d3578 |
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
|
|
|
8d3578 |
---
|
|
|
8d3578 |
src/providers/ad/ad_common.c | 23 ++++++++++++++++++++---
|
|
|
8d3578 |
1 file changed, 20 insertions(+), 3 deletions(-)
|
|
|
8d3578 |
|
|
|
8d3578 |
diff --git a/src/providers/ad/ad_common.c b/src/providers/ad/ad_common.c
|
|
|
8d3578 |
index 1b8b1df19..ca4d0665d 100644
|
|
|
8d3578 |
--- a/src/providers/ad/ad_common.c
|
|
|
8d3578 |
+++ b/src/providers/ad/ad_common.c
|
|
|
8d3578 |
@@ -1466,9 +1466,26 @@ errno_t ad_inherit_opts_if_needed(struct dp_option *parent_opts,
|
|
|
8d3578 |
const char *parent_val = NULL;
|
|
|
8d3578 |
char *dummy = NULL;
|
|
|
8d3578 |
char *option_list[2] = { NULL, NULL };
|
|
|
8d3578 |
-
|
|
|
8d3578 |
- parent_val = dp_opt_get_cstring(parent_opts, opt_id);
|
|
|
8d3578 |
- if (parent_val != NULL) {
|
|
|
8d3578 |
+ bool is_default = true;
|
|
|
8d3578 |
+
|
|
|
8d3578 |
+ switch (parent_opts[opt_id].type) {
|
|
|
8d3578 |
+ case DP_OPT_STRING:
|
|
|
8d3578 |
+ parent_val = dp_opt_get_cstring(parent_opts, opt_id);
|
|
|
8d3578 |
+ break;
|
|
|
8d3578 |
+ case DP_OPT_BOOL:
|
|
|
8d3578 |
+ /* For booleans it is hard to say if the option is set or not since
|
|
|
8d3578 |
+ * both possible values are valid ones. So we check if the value is
|
|
|
8d3578 |
+ * different from the default and skip if it is the default. In this
|
|
|
8d3578 |
+ * case the sub-domain option would either be the default as well or
|
|
|
8d3578 |
+ * manully set and in both cases we do not have to change it. */
|
|
|
8d3578 |
+ is_default = (parent_opts[opt_id].val.boolean
|
|
|
8d3578 |
+ == parent_opts[opt_id].def_val.boolean);
|
|
|
8d3578 |
+ break;
|
|
|
8d3578 |
+ default:
|
|
|
8d3578 |
+ DEBUG(SSSDBG_TRACE_FUNC, "Unsupported type, skipping.\n");
|
|
|
8d3578 |
+ }
|
|
|
8d3578 |
+
|
|
|
8d3578 |
+ if (parent_val != NULL || !is_default) {
|
|
|
8d3578 |
ret = confdb_get_string(cdb, NULL, subdom_conf_path,
|
|
|
8d3578 |
parent_opts[opt_id].opt_name, NULL, &dummy);
|
|
|
8d3578 |
if (ret != EOK) {
|
|
|
8d3578 |
--
|
|
|
8d3578 |
2.20.1
|
|
|
8d3578 |
|