dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0203-confdb-Add-new-option-subdomain_inherit.patch

e543c9
From a4dcc9a1290cfb82fde44bb8f4a4ab8d4668cd5b Mon Sep 17 00:00:00 2001
e543c9
From: Jakub Hrozek <jhrozek@redhat.com>
e543c9
Date: Wed, 29 Apr 2015 19:41:14 +0200
e543c9
Subject: [PATCH 203/207] confdb: Add new option subdomain_inherit
e543c9
e543c9
Adds a new option subdomain_inherit that would allow administrators to pick
e543c9
and choose which option to pass to subdomains.
e543c9
e543c9
This option is required for:
e543c9
    https://fedorahosted.org/sssd/ticket/2644
e543c9
as a short-term fix.
e543c9
e543c9
The proper solution is described in:
e543c9
    https://fedorahosted.org/sssd/ticket/2599
e543c9
e543c9
Reviewed-by: Pavel Reichl <preichl@redhat.com>
e543c9
(cherry picked from commit 1711cbfd2e36d44af1ae50e3a2beeec3a1f0b5e8)
e543c9
---
e543c9
 src/confdb/confdb.c                  | 13 +++++++++++++
e543c9
 src/confdb/confdb.h                  |  2 ++
e543c9
 src/config/SSSDConfig/__init__.py.in |  1 +
e543c9
 src/config/SSSDConfigTest.py         |  6 ++++--
e543c9
 src/config/etc/sssd.api.conf         |  1 +
e543c9
 src/man/sssd.conf.5.xml              | 20 +++++++++++++++++++-
e543c9
 6 files changed, 40 insertions(+), 3 deletions(-)
e543c9
e543c9
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
e543c9
index c55a945..6b2ce73 100644
e543c9
--- a/src/confdb/confdb.c
e543c9
+++ b/src/confdb/confdb.c
e543c9
@@ -1212,6 +1212,19 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
e543c9
         }
e543c9
     }
e543c9
 
e543c9
+    tmp = ldb_msg_find_attr_as_string(res->msgs[0],
e543c9
+                                      CONFDB_DOMAIN_SUBDOMAIN_INHERIT,
e543c9
+                                      NULL);
e543c9
+    if (tmp != NULL) {
e543c9
+        ret = split_on_separator(domain, tmp, ',', true, true,
e543c9
+                                 &domain->sd_inherit, NULL);
e543c9
+        if (ret != 0) {
e543c9
+            DEBUG(SSSDBG_FATAL_FAILURE,
e543c9
+                  "Cannot parse %s\n", CONFDB_SUBDOMAIN_ENUMERATE);
e543c9
+            goto done;
e543c9
+        }
e543c9
+    }
e543c9
+
e543c9
     ret = get_entry_as_uint32(res->msgs[0], &domain->subdomain_refresh_interval,
e543c9
                               CONFDB_DOMAIN_SUBDOMAIN_REFRESH, 14400);
e543c9
     if (ret != EOK || domain->subdomain_refresh_interval == 0) {
e543c9
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
e543c9
index 159aa9f..468c757 100644
e543c9
--- a/src/confdb/confdb.h
e543c9
+++ b/src/confdb/confdb.h
e543c9
@@ -183,6 +183,7 @@
e543c9
 #define CONFDB_DOMAIN_PWD_EXPIRATION_WARNING "pwd_expiration_warning"
e543c9
 #define CONFDB_DOMAIN_REFRESH_EXPIRED_INTERVAL "refresh_expired_interval"
e543c9
 #define CONFDB_DOMAIN_OFFLINE_TIMEOUT "offline_timeout"
e543c9
+#define CONFDB_DOMAIN_SUBDOMAIN_INHERIT "subdomain_inherit"
e543c9
 
e543c9
 /* Local Provider */
e543c9
 #define CONFDB_LOCAL_DEFAULT_SHELL   "default_shell"
e543c9
@@ -263,6 +264,7 @@ struct sss_domain_info {
e543c9
     struct sss_domain_info *next;
e543c9
 
e543c9
     bool disabled;
e543c9
+    char **sd_inherit;
e543c9
 };
e543c9
 
e543c9
 /**
e543c9
diff --git a/src/config/SSSDConfig/__init__.py.in b/src/config/SSSDConfig/__init__.py.in
e543c9
index 500bd71..8b9ab5a 100644
e543c9
--- a/src/config/SSSDConfig/__init__.py.in
e543c9
+++ b/src/config/SSSDConfig/__init__.py.in
e543c9
@@ -144,6 +144,7 @@ option_strings = {
e543c9
     'dyndns_auth' : _("What kind of authentication should be used to perform the DNS update"),
e543c9
     'subdomain_enumerate' : _('Control enumeration of trusted domains'),
e543c9
     'subdomain_refresh_interval' : _('How often should subdomains list be refreshed'),
e543c9
+    'subdomain_inherit' : _('List of options that should be inherited into a subdomain'),
e543c9
 
e543c9
     # [provider/ipa]
e543c9
     'ipa_domain' : _('IPA domain'),
e543c9
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
e543c9
index 78e22f6..6719132 100755
e543c9
--- a/src/config/SSSDConfigTest.py
e543c9
+++ b/src/config/SSSDConfigTest.py
e543c9
@@ -538,7 +538,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
e543c9
             'hostid_provider',
e543c9
             'subdomains_provider',
e543c9
             'realmd_tags',
e543c9
-            'subdomain_refresh_interval']
e543c9
+            'subdomain_refresh_interval',
e543c9
+            'subdomain_inherit']
e543c9
 
e543c9
         self.assertTrue(type(options) == dict,
e543c9
                         "Options should be a dictionary")
e543c9
@@ -897,7 +898,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
e543c9
             'hostid_provider',
e543c9
             'subdomains_provider',
e543c9
             'realmd_tags',
e543c9
-            'subdomain_refresh_interval']
e543c9
+            'subdomain_refresh_interval',
e543c9
+            'subdomain_inherit']
e543c9
 
e543c9
         self.assertTrue(type(options) == dict,
e543c9
                         "Options should be a dictionary")
e543c9
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
e543c9
index c16769a..8b3dee6 100644
e543c9
--- a/src/config/etc/sssd.api.conf
e543c9
+++ b/src/config/etc/sssd.api.conf
e543c9
@@ -129,6 +129,7 @@ default_shell = str, None, false
e543c9
 description = str, None, false
e543c9
 realmd_tags = str, None, false
e543c9
 subdomain_refresh_interval = int, None, false
e543c9
+subdomain_inherit = str, None, false
e543c9
 
e543c9
 #Entry cache timeouts
e543c9
 entry_cache_user_timeout = int, None, false
e543c9
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
e543c9
index 2002ccc..f7d688a 100644
e543c9
--- a/src/man/sssd.conf.5.xml
e543c9
+++ b/src/man/sssd.conf.5.xml
e543c9
@@ -476,7 +476,25 @@
e543c9
                         </para>
e543c9
                     </listitem>
e543c9
                 </varlistentry>
e543c9
-
e543c9
+                <varlistentry>
e543c9
+                    <term>subdomain_inherit (string)</term>
e543c9
+                    <listitem>
e543c9
+                        <para>
e543c9
+                            Specifies a list of configuration parameters that
e543c9
+                            should be inherited by a subdomain. Please note
e543c9
+                            that only selected parameters can be inherited.
e543c9
+                        </para>
e543c9
+                        <para>
e543c9
+                            Example:
e543c9
+                            <programlisting>
e543c9
+subdomain_inherit = ldap_purge_cache_timeout
e543c9
+                            </programlisting>
e543c9
+                        </para>
e543c9
+                        <para>
e543c9
+                            Default: none
e543c9
+                        </para>
e543c9
+                    </listitem>
e543c9
+                </varlistentry>
e543c9
             </variablelist>
e543c9
         </refsect2>
e543c9
 
e543c9
-- 
e543c9
2.1.0
e543c9