dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0174-views-fix-GID-overrride-for-mpg-domains.patch

905b4d
From 4663b9a486964533183533046f7093e9a3a9b75b Mon Sep 17 00:00:00 2001
905b4d
From: Sumit Bose <sbose@redhat.com>
905b4d
Date: Wed, 21 Jan 2015 12:35:00 +0100
905b4d
Subject: [PATCH 174/176] views: fix GID overrride for mpg domains
905b4d
905b4d
When adding a user sysdb internally adds a value to SYSDB_GIDNUM for
905b4d
mpg domain which might cause conflicts with the one we added to users
905b4d
git GID overrides. With this patch the override GID is added after the
905b4d
user is created but in the same transaction
905b4d
905b4d
Releted to https://fedorahosted.org/sssd/ticket/2514
905b4d
905b4d
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
905b4d
(cherry picked from commit ba818cc39dfe94c2b8613f4badf7912811f0f737)
905b4d
---
905b4d
 src/providers/ipa/ipa_s2n_exop.c | 21 ++++++++++++++++++++-
905b4d
 1 file changed, 20 insertions(+), 1 deletion(-)
905b4d
905b4d
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
905b4d
index e7c2d9bb97908746eb5ab6cacc6fc58d353dea06..a9c2f1ae3955bc3d2707bbcd186609a8d76b6169 100644
905b4d
--- a/src/providers/ipa/ipa_s2n_exop.c
905b4d
+++ b/src/providers/ipa/ipa_s2n_exop.c
905b4d
@@ -1748,6 +1748,7 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
905b4d
     char **del_groups_dns;
905b4d
     bool in_transaction = false;
905b4d
     int tret;
905b4d
+    struct sysdb_attrs *gid_override_attrs = NULL;
905b4d
 
905b4d
     tmp_ctx = talloc_new(NULL);
905b4d
     if (tmp_ctx == NULL) {
905b4d
@@ -1939,7 +1940,16 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
905b4d
                 if (ret == EOK || ret == ENOENT) {
905b4d
                     if ((orig_gid != 0 && orig_gid != attrs->a.user.pw_gid)
905b4d
                             || attrs->a.user.pw_uid != attrs->a.user.pw_gid) {
905b4d
-                        ret = sysdb_attrs_add_uint32(attrs->sysdb_attrs,
905b4d
+
905b4d
+                        gid_override_attrs = sysdb_new_attrs(tmp_ctx);
905b4d
+                        if (gid_override_attrs == NULL) {
905b4d
+                            DEBUG(SSSDBG_OP_FAILURE,
905b4d
+                                  "sysdb_new_attrs failed.\n");
905b4d
+                            ret = ENOMEM;
905b4d
+                            goto done;
905b4d
+                        }
905b4d
+
905b4d
+                        ret = sysdb_attrs_add_uint32(gid_override_attrs,
905b4d
                                                      SYSDB_GIDNUM,
905b4d
                                                      attrs->a.user.pw_gid);
905b4d
                         if (ret != EOK) {
905b4d
@@ -1973,6 +1983,15 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
905b4d
                 goto done;
905b4d
             }
905b4d
 
905b4d
+            if (gid_override_attrs != NULL) {
905b4d
+                ret = sysdb_set_user_attr(dom, name, gid_override_attrs,
905b4d
+                                          SYSDB_MOD_REP);
905b4d
+                if (ret != EOK) {
905b4d
+                    DEBUG(SSSDBG_OP_FAILURE, "sysdb_set_user_attr failed.\n");
905b4d
+                    goto done;
905b4d
+                }
905b4d
+            }
905b4d
+
905b4d
             if (attrs->response_type == RESP_USER_GROUPLIST) {
905b4d
                 ret = get_sysdb_grouplist(tmp_ctx, dom->sysdb, dom, name,
905b4d
                                           &sysdb_grouplist);
905b4d
-- 
905b4d
2.1.0
905b4d