Blame SOURCES/0004-CONFIG-Add-a-new-option-auto_private_groups.patch

9f2ebf
From 1deab05ac0820d9be261b55027a90078a758febd Mon Sep 17 00:00:00 2001
9f2ebf
From: Jakub Hrozek <jhrozek@redhat.com>
9f2ebf
Date: Tue, 3 Oct 2017 12:34:33 +0200
9f2ebf
Subject: [PATCH 04/21] CONFIG: Add a new option auto_private_groups
9f2ebf
MIME-Version: 1.0
9f2ebf
Content-Type: text/plain; charset=UTF-8
9f2ebf
Content-Transfer-Encoding: 8bit
9f2ebf
9f2ebf
The auto_private_groups option is used to configure the domain->mpg flag
9f2ebf
which was already set automatically for subdomains, but for some time was
9f2ebf
not settable by the admin via the configuration file.
9f2ebf
9f2ebf
The new option name, instead of the old magic_private_groups, was chosen
9f2ebf
purely because this name would hopefully be better understood by admins.
9f2ebf
9f2ebf
The option doesn't do anything yet, it is just added to all the places a
9f2ebf
new option should be added to.
9f2ebf
9f2ebf
Related:
9f2ebf
    https://pagure.io/SSSD/sssd/issue/1872
9f2ebf
9f2ebf
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
9f2ebf
Reviewed-by: Pavel Březina <pbrezina@redhat.com>
9f2ebf
(cherry picked from commit d72ac2c58360cd272277b5ddde67bbff53106a74)
9f2ebf
---
9f2ebf
 src/confdb/confdb.c                  |  8 ++++++++
9f2ebf
 src/confdb/confdb.h                  |  1 +
9f2ebf
 src/config/SSSDConfig/__init__.py.in |  1 +
9f2ebf
 src/config/SSSDConfigTest.py         |  6 ++++--
9f2ebf
 src/config/cfg_rules.ini             |  1 +
9f2ebf
 src/config/etc/sssd.api.conf         |  1 +
9f2ebf
 src/man/sssd.conf.5.xml              | 20 ++++++++++++++++++++
9f2ebf
 7 files changed, 36 insertions(+), 2 deletions(-)
9f2ebf
9f2ebf
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
9f2ebf
index fefecc03d554f6eca12efe07990bfae17033bd02..a028224817f12ace2a0c4165d7b9cb0bb80ce5a1 100644
9f2ebf
--- a/src/confdb/confdb.c
9f2ebf
+++ b/src/confdb/confdb.c
9f2ebf
@@ -936,6 +936,14 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
9f2ebf
         goto done;
9f2ebf
     }
9f2ebf
 
9f2ebf
+    ret = get_entry_as_bool(res->msgs[0], &domain->mpg,
9f2ebf
+                            CONFDB_DOMAIN_AUTO_UPG, 0);
9f2ebf
+    if (ret != EOK) {
9f2ebf
+        DEBUG(SSSDBG_FATAL_FAILURE,
9f2ebf
+              "Invalid value for %s\n", CONFDB_DOMAIN_AUTO_UPG);
9f2ebf
+        goto done;
9f2ebf
+    }
9f2ebf
+
9f2ebf
     if (strcasecmp(domain->provider, "local") == 0) {
9f2ebf
         /* If this is the local provider, we need to ensure that
9f2ebf
          * no other provider was specified for other types, since
9f2ebf
diff --git a/src/confdb/confdb.h b/src/confdb/confdb.h
9f2ebf
index bcea99ae49a3fa5f0393ce6b2c215b5b2d4bc3fc..2539b906993edbceb38aac9265e04deed69cf2e4 100644
9f2ebf
--- a/src/confdb/confdb.h
9f2ebf
+++ b/src/confdb/confdb.h
9f2ebf
@@ -198,6 +198,7 @@
9f2ebf
 #define CONFDB_DEFAULT_CACHE_CREDS_MIN_FF_LENGTH 8
9f2ebf
 #define CONFDB_DOMAIN_LEGACY_PASS "store_legacy_passwords"
9f2ebf
 #define CONFDB_DOMAIN_MPG "magic_private_groups"
9f2ebf
+#define CONFDB_DOMAIN_AUTO_UPG "auto_private_groups"
9f2ebf
 #define CONFDB_DOMAIN_FQ "use_fully_qualified_names"
9f2ebf
 #define CONFDB_DOMAIN_ENTRY_CACHE_TIMEOUT "entry_cache_timeout"
9f2ebf
 #define CONFDB_DOMAIN_ACCOUNT_CACHE_EXPIRATION "account_cache_expiration"
9f2ebf
diff --git a/src/config/SSSDConfig/__init__.py.in b/src/config/SSSDConfig/__init__.py.in
9f2ebf
index d99b718e09283d113f73639e0f94e7f1cec55f68..d2bb709d69c8790558b5c06a7e405463b508c189 100644
9f2ebf
--- a/src/config/SSSDConfig/__init__.py.in
9f2ebf
+++ b/src/config/SSSDConfig/__init__.py.in
9f2ebf
@@ -195,6 +195,7 @@ option_strings = {
9f2ebf
     'cached_auth_timeout' : _('How long can cached credentials be used for cached authentication'),
9f2ebf
     'full_name_format' : _('Printf-compatible format for displaying fully-qualified names'),
9f2ebf
     're_expression' : _('Regex to parse username and domain'),
9f2ebf
+    'auto_private_groups' : _('Whether to automatically create private groups for users'),
9f2ebf
 
9f2ebf
     # [provider/ipa]
9f2ebf
     'ipa_domain' : _('IPA domain'),
9f2ebf
diff --git a/src/config/SSSDConfigTest.py b/src/config/SSSDConfigTest.py
9f2ebf
index 4a583bdd3124dc05a116d2e6bd48afb92aa0b54d..87d1f6e6410dfeafc77d578cf0b950dc71a1f0a2 100755
9f2ebf
--- a/src/config/SSSDConfigTest.py
9f2ebf
+++ b/src/config/SSSDConfigTest.py
9f2ebf
@@ -624,7 +624,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
9f2ebf
             'subdomain_homedir',
9f2ebf
             'full_name_format',
9f2ebf
             're_expression',
9f2ebf
-            'cached_auth_timeout']
9f2ebf
+            'cached_auth_timeout',
9f2ebf
+            'auto_private_groups']
9f2ebf
 
9f2ebf
         self.assertTrue(type(options) == dict,
9f2ebf
                         "Options should be a dictionary")
9f2ebf
@@ -994,7 +995,8 @@ class SSSDConfigTestSSSDDomain(unittest.TestCase):
9f2ebf
             'subdomain_homedir',
9f2ebf
             'full_name_format',
9f2ebf
             're_expression',
9f2ebf
-            'cached_auth_timeout']
9f2ebf
+            'cached_auth_timeout',
9f2ebf
+            'auto_private_groups']
9f2ebf
 
9f2ebf
         self.assertTrue(type(options) == dict,
9f2ebf
                         "Options should be a dictionary")
9f2ebf
diff --git a/src/config/cfg_rules.ini b/src/config/cfg_rules.ini
9f2ebf
index e49e8d43f4aead14d833866110784fd62382cc2b..4e70bf7b6f0fa7421a0c35bd4279830265bf3470 100644
9f2ebf
--- a/src/config/cfg_rules.ini
9f2ebf
+++ b/src/config/cfg_rules.ini
9f2ebf
@@ -382,6 +382,7 @@ option = cached_auth_timeout
9f2ebf
 option = wildcard_limit
9f2ebf
 option = full_name_format
9f2ebf
 option = re_expression
9f2ebf
+option = auto_private_groups
9f2ebf
 
9f2ebf
 #Entry cache timeouts
9f2ebf
 option = entry_cache_user_timeout
9f2ebf
diff --git a/src/config/etc/sssd.api.conf b/src/config/etc/sssd.api.conf
9f2ebf
index 7f2b8977b7e67fcfc20df49056cda8ebe6da0be8..2be2e3e685ba3abd9a4a419f93332a89ff774262 100644
9f2ebf
--- a/src/config/etc/sssd.api.conf
9f2ebf
+++ b/src/config/etc/sssd.api.conf
9f2ebf
@@ -185,6 +185,7 @@ subdomain_homedir = str, None, false
9f2ebf
 cached_auth_timeout = int, None, false
9f2ebf
 full_name_format = str, None, false
9f2ebf
 re_expression = str, None, false
9f2ebf
+auto_private_groups = str, None, false
9f2ebf
 
9f2ebf
 #Entry cache timeouts
9f2ebf
 entry_cache_user_timeout = int, None, false
9f2ebf
diff --git a/src/man/sssd.conf.5.xml b/src/man/sssd.conf.5.xml
9f2ebf
index 7443f718319e292842c670aaf47cfc537545d021..47da07c33bdcfbf2fa94ff932492e9ea4bbfe846 100644
9f2ebf
--- a/src/man/sssd.conf.5.xml
9f2ebf
+++ b/src/man/sssd.conf.5.xml
9f2ebf
@@ -2823,6 +2823,26 @@ subdomain_inherit = ldap_purge_cache_timeout
9f2ebf
                         </para>
9f2ebf
                     </listitem>
9f2ebf
                 </varlistentry>
9f2ebf
+                <varlistentry>
9f2ebf
+                    <term>auto_private_groups (string)</term>
9f2ebf
+                    <listitem>
9f2ebf
+                        <para>
9f2ebf
+                            If this option is enabled, SSSD will automatically
9f2ebf
+                            create user private groups based on user's
9f2ebf
+                            UID number. The GID number is ignored in this case.
9f2ebf
+                        </para>
9f2ebf
+                        <para>
9f2ebf
+                            NOTE: Because the GID number and the user private group
9f2ebf
+                            are inferred frm the UID number, it is not supported
9f2ebf
+                            to have multiple entries with the same UID or GID number
9f2ebf
+                            with this option. In other words, enabling this option
9f2ebf
+                            enforces uniqueness across the ID space.
9f2ebf
+                        </para>
9f2ebf
+                        <para>
9f2ebf
+                            Default: False
9f2ebf
+                        </para>
9f2ebf
+                    </listitem>
9f2ebf
+                </varlistentry>
9f2ebf
             </variablelist>
9f2ebf
         </para>
9f2ebf
 
9f2ebf
-- 
9f2ebf
2.13.5
9f2ebf