summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_search.c
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2014-10-06 13:44:37 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-10-09 17:14:30 +0200
commit36ea9f2a4ff47a045625203a02c6deed9c53e169 (patch)
tree7d3979b19368634b0d1755b6b7ca1c35da543cea /src/db/sysdb_search.c
parent38e8362ba7b0403527403d79b36d03a5dbd621ac (diff)
downloadsssd-36ea9f2a4ff47a045625203a02c6deed9c53e169.tar.gz
sssd-36ea9f2a4ff47a045625203a02c6deed9c53e169.tar.xz
sssd-36ea9f2a4ff47a045625203a02c6deed9c53e169.zip
sysdb_get_user_attr: use fqn for subdomain users
Name of subdomain users is stored with domain part in the sysdb. We need to use fully qualified names for those user so we can look them up. Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/db/sysdb_search.c')
-rw-r--r--src/db/sysdb_search.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/db/sysdb_search.c b/src/db/sysdb_search.c
index 2ae215055..d51d2134a 100644
--- a/src/db/sysdb_search.c
+++ b/src/db/sysdb_search.c
@@ -478,6 +478,7 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
TALLOC_CTX *tmp_ctx;
struct ldb_dn *base_dn;
struct ldb_result *res;
+ const char *src_name;
char *sanitized_name;
char *lc_sanitized_name;
int ret;
@@ -494,8 +495,16 @@ int sysdb_get_user_attr(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sss_filter_sanitize_for_dom(tmp_ctx, name, domain, &sanitized_name,
- &lc_sanitized_name);
+ /* If this is a subdomain we need to use fully qualified names for the
+ * search as well by default */
+ src_name = sss_get_domain_name(tmp_ctx, name, domain);
+ if (!src_name) {
+ ret = ENOMEM;
+ goto done;
+ }
+
+ ret = sss_filter_sanitize_for_dom(tmp_ctx, src_name, domain,
+ &sanitized_name, &lc_sanitized_name);
if (ret != EOK) {
goto done;
}