|
|
75e304 |
From a6de362d3cfe16550eb16d01900f44c9aeb8cc50 Mon Sep 17 00:00:00 2001
|
|
|
75e304 |
From: Sumit Bose <sbose@redhat.com>
|
|
|
75e304 |
Date: Tue, 29 May 2018 15:42:55 +0200
|
|
|
75e304 |
Subject: [PATCH] ipa: use mpg aware group lookup in get_object_from_cache()
|
|
|
75e304 |
|
|
|
75e304 |
Since with algorithmic id-mapping SSSD automatically creates user
|
|
|
75e304 |
private groups for AD user with the help of magic private groups (mpg)
|
|
|
75e304 |
get_object_from_cache() should use mpg aware calls to make sure the
|
|
|
75e304 |
right user object is found when handling a request to look up a user
|
|
|
75e304 |
private group.
|
|
|
75e304 |
|
|
|
75e304 |
Only the lookup by gid had to be modified because
|
|
|
75e304 |
sysdb_search_group_by_name() used for lookups by name is aware of MPGs.
|
|
|
75e304 |
|
|
|
75e304 |
Related to https://pagure.io/SSSD/sssd/issue/3748
|
|
|
75e304 |
|
|
|
75e304 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
75e304 |
(cherry picked from commit 032221568fe4287686d0ebb11b5c1fe51cc4735f)
|
|
|
75e304 |
---
|
|
|
75e304 |
src/providers/ipa/ipa_subdomains_id.c | 18 ++++++++++++++++--
|
|
|
75e304 |
1 file changed, 16 insertions(+), 2 deletions(-)
|
|
|
75e304 |
|
|
|
75e304 |
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
|
|
|
75e304 |
index d40671086854f9c1a3f8bc7fc711009298dc31c8..3943579b07c7b2d32dde192b97b86eb036b91885 100644
|
|
|
75e304 |
--- a/src/providers/ipa/ipa_subdomains_id.c
|
|
|
75e304 |
+++ b/src/providers/ipa/ipa_subdomains_id.c
|
|
|
75e304 |
@@ -1030,7 +1030,14 @@ errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
|
|
|
75e304 |
|
|
|
75e304 |
switch (ar->entry_type & BE_REQ_TYPE_MASK) {
|
|
|
75e304 |
case BE_REQ_GROUP:
|
|
|
75e304 |
- ret = sysdb_search_group_by_gid(mem_ctx, dom, id, attrs, &msg;;
|
|
|
75e304 |
+ ret = sysdb_getgrgid_attrs(mem_ctx, dom, id, attrs, &res;;
|
|
|
75e304 |
+ if (ret == EOK) {
|
|
|
75e304 |
+ if (res->count == 0) {
|
|
|
75e304 |
+ ret = ENOENT;
|
|
|
75e304 |
+ } else {
|
|
|
75e304 |
+ msg = res->msgs[0];
|
|
|
75e304 |
+ }
|
|
|
75e304 |
+ }
|
|
|
75e304 |
break;
|
|
|
75e304 |
case BE_REQ_INITGROUPS:
|
|
|
75e304 |
case BE_REQ_USER:
|
|
|
75e304 |
@@ -1038,7 +1045,14 @@ errno_t get_object_from_cache(TALLOC_CTX *mem_ctx,
|
|
|
75e304 |
ret = sysdb_search_user_by_uid(mem_ctx, dom, id, attrs, &msg;;
|
|
|
75e304 |
if (ret == ENOENT && (ar->entry_type & BE_REQ_TYPE_MASK)
|
|
|
75e304 |
== BE_REQ_USER_AND_GROUP) {
|
|
|
75e304 |
- ret = sysdb_search_group_by_gid(mem_ctx, dom, id, attrs, &msg;;
|
|
|
75e304 |
+ ret = sysdb_getgrgid_attrs(mem_ctx, dom, id, attrs, &res;;
|
|
|
75e304 |
+ if (ret == EOK) {
|
|
|
75e304 |
+ if (res->count == 0) {
|
|
|
75e304 |
+ ret = ENOENT;
|
|
|
75e304 |
+ } else {
|
|
|
75e304 |
+ msg = res->msgs[0];
|
|
|
75e304 |
+ }
|
|
|
75e304 |
+ }
|
|
|
75e304 |
}
|
|
|
75e304 |
break;
|
|
|
75e304 |
default:
|
|
|
75e304 |
--
|
|
|
75e304 |
2.14.4
|
|
|
75e304 |
|