summaryrefslogtreecommitdiffstats
path: root/src/db/sysdb_ops.c
diff options
context:
space:
mode:
authorSumit Bose <sbose@redhat.com>2013-12-13 11:44:59 +0100
committerJakub Hrozek <jhrozek@redhat.com>2013-12-19 10:24:16 +0100
commit15a1519ec9c23f598716ffa89e533cd9bfb2a4f3 (patch)
tree8dda85aa957c9b29cd7db696c6caae7fb8ac64ae /src/db/sysdb_ops.c
parentc9124effceb40890bc9dd157155618067a7b8d2f (diff)
downloadsssd-15a1519ec9c23f598716ffa89e533cd9bfb2a4f3.tar.gz
sssd-15a1519ec9c23f598716ffa89e533cd9bfb2a4f3.tar.xz
sssd-15a1519ec9c23f598716ffa89e533cd9bfb2a4f3.zip
Use lower-case name for case-insensitive searches
The patch makes sure that a completely lower-cased version of a fully qualified name is used for case insensitive searches. Currently there are code paths where the domain name was used as configured and was not lower-cased. To make sure this patch does not break with old entries in the cache or case sensitive domains a third template was added to the related filters templates which is either filled with a completely lower-cased version or with the old version. The other two template values are unchanged.
Diffstat (limited to 'src/db/sysdb_ops.c')
-rw-r--r--src/db/sysdb_ops.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c
index adbe9a158..cb331e1e2 100644
--- a/src/db/sysdb_ops.c
+++ b/src/db/sysdb_ops.c
@@ -305,6 +305,7 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
struct ldb_dn *basedn;
size_t msgs_count = 0;
char *sanitized_name;
+ char *lc_sanitized_name;
char *filter;
int ret;
@@ -320,13 +321,14 @@ int sysdb_search_user_by_name(TALLOC_CTX *mem_ctx,
goto done;
}
- ret = sss_filter_sanitize(tmp_ctx, name, &sanitized_name);
+ ret = sss_filter_sanitize_for_dom(tmp_ctx, name, domain, &sanitized_name,
+ &lc_sanitized_name);
if (ret != EOK) {
goto done;
}
- filter = talloc_asprintf(tmp_ctx, SYSDB_PWNAM_FILTER, sanitized_name,
- sanitized_name);
+ filter = talloc_asprintf(tmp_ctx, SYSDB_PWNAM_FILTER, lc_sanitized_name,
+ sanitized_name, sanitized_name);
if (!filter) {
ret = ENOMEM;
goto done;