dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0181-IPA-Use-attr-s-dom-for-users-too.patch

905b4d
From 8ffc33de4e1ea85159ee72178efafaac060a8c3b Mon Sep 17 00:00:00 2001
905b4d
From: Jakub Hrozek <jhrozek@redhat.com>
905b4d
Date: Mon, 26 Jan 2015 20:29:37 +0100
905b4d
Subject: [PATCH 181/181] IPA: Use attr's dom for users, too
905b4d
905b4d
The 'dom' pointer points to domain of the main object being saved. In
905b4d
case of group, dom points to the domain where the group resides. But
905b4d
when saving members, each members might be from a different domain, so we
905b4d
need to find every member's domain based on the attributes.
905b4d
905b4d
Also don't use Yoda style in conditions.
905b4d
905b4d
Reviewed-by: Sumit Bose <sbose@redhat.com>
905b4d
(cherry picked from commit b2c5e98def89a0c3d16f5cf7e07ce2020338b540)
905b4d
---
905b4d
 src/providers/ipa/ipa_s2n_exop.c | 22 +++++++++++-----------
905b4d
 1 file changed, 11 insertions(+), 11 deletions(-)
905b4d
905b4d
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
905b4d
index 6f8d5687d66717ba62e83da27dd6b23bc12151fb..35bd303d4aa3651e80c70297507bdc85d05bfbde 100644
905b4d
--- a/src/providers/ipa/ipa_s2n_exop.c
905b4d
+++ b/src/providers/ipa/ipa_s2n_exop.c
905b4d
@@ -1819,6 +1819,17 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
905b4d
         }
905b4d
     }
905b4d
 
905b4d
+    if (strcmp(dom->name, attrs->domain_name) != 0) {
905b4d
+        dom = find_domain_by_name(get_domains_head(dom),
905b4d
+                                  attrs->domain_name, true);
905b4d
+        if (dom == NULL) {
905b4d
+            DEBUG(SSSDBG_OP_FAILURE,
905b4d
+                    "Cannot find domain: [%s]\n", attrs->domain_name);
905b4d
+            ret = EINVAL;
905b4d
+            goto done;
905b4d
+        }
905b4d
+    }
905b4d
+
905b4d
     switch (attrs->response_type) {
905b4d
         case RESP_USER:
905b4d
         case RESP_USER_GROUPLIST:
905b4d
@@ -2057,17 +2068,6 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
905b4d
         case RESP_GROUP_MEMBERS:
905b4d
             type = SYSDB_MEMBER_GROUP;
905b4d
 
905b4d
-            if (0 != strcmp(dom->name, attrs->domain_name)) {
905b4d
-                dom = find_domain_by_name(get_domains_head(dom),
905b4d
-                                          attrs->domain_name, true);
905b4d
-                if (dom == NULL) {
905b4d
-                    DEBUG(SSSDBG_OP_FAILURE,
905b4d
-                          "Cannot find domain: [%s]\n", attrs->domain_name);
905b4d
-                    ret = EINVAL;
905b4d
-                    goto done;
905b4d
-                }
905b4d
-            }
905b4d
-
905b4d
             if (name == NULL) {
905b4d
                 name = attrs->a.group.gr_name;
905b4d
             }
905b4d
-- 
905b4d
2.1.0
905b4d