summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
}