summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Bokovoy <abokovoy@redhat.com>2014-05-13 11:22:29 +0300
committerJakub Hrozek <jhrozek@redhat.com>2014-05-21 15:13:44 +0200
commit33d70148eac28c548b10eb3aa36ab23169cedc5a (patch)
treee2f960a0f936da92c34aaf48e624aa35a6086386
parent7aaf9138ccf7ab73883f28cfafd6e508d29ffa67 (diff)
downloadsssd-33d70148eac28c548b10eb3aa36ab23169cedc5a.tar.gz
sssd-33d70148eac28c548b10eb3aa36ab23169cedc5a.tar.xz
sssd-33d70148eac28c548b10eb3aa36ab23169cedc5a.zip
ipa subdomains provider: make sure search by SID works for homedir
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--src/providers/ipa/ipa_subdomains_id.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/providers/ipa/ipa_subdomains_id.c b/src/providers/ipa/ipa_subdomains_id.c
index bef96e658..21e9f85a1 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, 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, uid, &res);
+ } else if (filter_type == BE_FILTER_SECID) {
+ ret = sysdb_search_user_by_sid_str(mem_ctx, 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);