summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2015-01-26 20:29:37 +0100
committerJakub Hrozek <jhrozek@redhat.com>2015-01-27 09:49:32 +0100
commit8ffc33de4e1ea85159ee72178efafaac060a8c3b (patch)
tree4b93b70a522d63a5789ba9732e6ba77f0bb1774a
parent11277f49cabdf4b7b49dba05dc4db9c2e5ffe53b (diff)
downloadsssd-8ffc33de4e1ea85159ee72178efafaac060a8c3b.tar.gz
sssd-8ffc33de4e1ea85159ee72178efafaac060a8c3b.tar.xz
sssd-8ffc33de4e1ea85159ee72178efafaac060a8c3b.zip
IPA: Use attr's dom for users, too
The 'dom' pointer points to domain of the main object being saved. In case of group, dom points to the domain where the group resides. But when saving members, each members might be from a different domain, so we need to find every member's domain based on the attributes. Also don't use Yoda style in conditions. Reviewed-by: Sumit Bose <sbose@redhat.com> (cherry picked from commit b2c5e98def89a0c3d16f5cf7e07ce2020338b540)
-rw-r--r--src/providers/ipa/ipa_s2n_exop.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/providers/ipa/ipa_s2n_exop.c b/src/providers/ipa/ipa_s2n_exop.c
index 6f8d5687d..35bd303d4 100644
--- a/src/providers/ipa/ipa_s2n_exop.c
+++ b/src/providers/ipa/ipa_s2n_exop.c
@@ -1819,6 +1819,17 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
}
}
+ if (strcmp(dom->name, attrs->domain_name) != 0) {
+ dom = find_domain_by_name(get_domains_head(dom),
+ attrs->domain_name, true);
+ if (dom == NULL) {
+ DEBUG(SSSDBG_OP_FAILURE,
+ "Cannot find domain: [%s]\n", attrs->domain_name);
+ ret = EINVAL;
+ goto done;
+ }
+ }
+
switch (attrs->response_type) {
case RESP_USER:
case RESP_USER_GROUPLIST:
@@ -2057,17 +2068,6 @@ static errno_t ipa_s2n_save_objects(struct sss_domain_info *dom,
case RESP_GROUP_MEMBERS:
type = SYSDB_MEMBER_GROUP;
- if (0 != strcmp(dom->name, attrs->domain_name)) {
- dom = find_domain_by_name(get_domains_head(dom),
- attrs->domain_name, true);
- if (dom == NULL) {
- DEBUG(SSSDBG_OP_FAILURE,
- "Cannot find domain: [%s]\n", attrs->domain_name);
- ret = EINVAL;
- goto done;
- }
- }
-
if (name == NULL) {
name = attrs->a.group.gr_name;
}