diff options
author | Sumit Bose <sbose@redhat.com> | 2013-12-13 11:44:59 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2013-12-19 11:11:40 +0100 |
commit | cbbbde7a66e176871aae37ed323e53ac41859e8d (patch) | |
tree | 8be1b07e25c7d5bc76ee5e5be2024a9d5e7ef9c4 /src/db/sysdb_ops.c | |
parent | 2e96a84a2be53586db82a20287988a8a422c98ea (diff) | |
download | sssd-cbbbde7a66e176871aae37ed323e53ac41859e8d.tar.gz sssd-cbbbde7a66e176871aae37ed323e53ac41859e8d.tar.xz sssd-cbbbde7a66e176871aae37ed323e53ac41859e8d.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.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/db/sysdb_ops.c b/src/db/sysdb_ops.c index 890bf1eb3..a5dfd443c 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; |