[SSSD] [PATCHES] IPA: SID works for homedir
Jakub Hrozek
jhrozek at redhat.com
Wed May 21 13:25:44 UTC 2014
On Wed, May 21, 2014 at 03:59:22PM +0300, Alexander Bokovoy wrote:
> On Tue, 20 May 2014, Jakub Hrozek wrote:
> >On Tue, May 13, 2014 at 02:25:49PM +0300, Alexander Bokovoy wrote:
> >>On Tue, 13 May 2014, Pavel Reichl wrote:
> >>>Hello,
> >>>
> >>>Alexander has prepared attached patches, but he was not able to post
> >>>them himself as he is currently having bad connection.
> >>Note that you cannot currently test them on master (other than compile)
> >>as master is broken with regards to AD integration in IPA mode due to
> >>sdap maps code.
> >>
> >>I've tested it by backporting to 1.11 branch (sssd-1-11) and it works
> >>there quite well:
> >
> >Thanks for the patch, I think we should do the same two amendments I
> >proposed for master.
> Right, just squash them together.
OK, here is the patch I'm going to push
-------------- next part --------------
>From 899b9d9c5b995e898fa73e9b59c0e8a7b2804ebe Mon Sep 17 00:00:00 2001
From: Alexander Bokovoy <abokovoy at redhat.com>
Date: Tue, 13 May 2014 11:22:29 +0300
Subject: [PATCH] ipa subdomains provider: make sure search by SID works for
homedir
Reviewed-by: Jakub Hrozek <jhrozek at redhat.com>
---
src/providers/ipa/ipa_subdomains_id.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index bf68554e6b9b477a85e3c213b28ee11e925c7c05..2d5c3b3eef644681766185cb2b41b20e226dc774 100644
--- a/src/providers/ipa/ipa_subdomains_id.c
+++ b/src/providers/ipa/ipa_subdomains_id.c
@@ -484,7 +484,11 @@ apply_subdomain_homedir(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
uint32_t uid;
const char *fqname;
const char *homedir = NULL;
- struct ldb_result *res;
+ struct ldb_result *res = NULL;
+ struct ldb_message *msg = NULL;
+ const char *attrs[] = { SYSDB_NAME,
+ SYSDB_UIDNUM,
+ NULL };
if (filter_type == BE_FILTER_NAME) {
ret = sysdb_getpwnam(mem_ctx, dom->sysdb, dom, filter_value, &res);
@@ -496,6 +500,9 @@ apply_subdomain_homedir(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
goto done;
}
ret = sysdb_getpwuid(mem_ctx, dom->sysdb, dom, uid, &res);
+ } else if (filter_type == BE_FILTER_SECID) {
+ ret = sysdb_search_user_by_sid_str(mem_ctx, dom->sysdb, dom,
+ filter_value, attrs, &msg);
} else {
DEBUG(SSSDBG_OP_FAILURE,
"Unsupported filter type: [%d].\n", filter_type);
@@ -503,24 +510,27 @@ apply_subdomain_homedir(TALLOC_CTX *mem_ctx, struct sss_domain_info *dom,
goto done;
}
- if (ret != EOK) {
+ if (ret != EOK && ret != ENOENT) {
DEBUG(SSSDBG_OP_FAILURE,
"Failed to make request to our cache: [%d]: [%s]\n",
ret, sss_strerror(ret));
goto done;
}
- if (res->count == 0) {
+ if ((res && res->count == 0) || (msg && msg->num_elements == 0)) {
ret = ENOENT;
goto done;
}
+ if (res != NULL) {
+ msg = res->msgs[0];
+ }
/*
* Homedir is always overriden by subdomain_homedir even if it was
* explicitly set by user.
*/
- fqname = ldb_msg_find_attr_as_string(res->msgs[0], SYSDB_NAME, NULL);
- uid = ldb_msg_find_attr_as_uint64(res->msgs[0], SYSDB_UIDNUM, 0);
+ fqname = ldb_msg_find_attr_as_string(msg, SYSDB_NAME, NULL);
+ uid = ldb_msg_find_attr_as_uint64(msg, SYSDB_UIDNUM, 0);
if (uid == 0) {
DEBUG(SSSDBG_OP_FAILURE, "UID for user [%s] is not known.\n",
filter_value);
--
1.9.0
More information about the sssd-devel
mailing list