diff options
author | Nathaniel McCallum <npmccallum@redhat.com> | 2013-07-16 11:47:27 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-07-18 18:08:53 +0200 |
commit | 6c0b7f3389a13d0fb86e5c3bd7d299a9e8629958 (patch) | |
tree | af840dd2272f89c4e4cb7ec00087c40b1c60f03e /daemons/ipa-kdb/ipa_kdb_common.c | |
parent | e95a7b1b8db9fb12c25fd371cac627352c5e93fb (diff) | |
download | freeipa-6c0b7f3389a13d0fb86e5c3bd7d299a9e8629958.tar.gz freeipa-6c0b7f3389a13d0fb86e5c3bd7d299a9e8629958.tar.xz freeipa-6c0b7f3389a13d0fb86e5c3bd7d299a9e8629958.zip |
Use libunistring ulc_casecmp() on unicode strings
https://fedorahosted.org/freeipa/ticket/3772
Diffstat (limited to 'daemons/ipa-kdb/ipa_kdb_common.c')
-rw-r--r-- | daemons/ipa-kdb/ipa_kdb_common.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/daemons/ipa-kdb/ipa_kdb_common.c b/daemons/ipa-kdb/ipa_kdb_common.c index e227602ea..112086b57 100644 --- a/daemons/ipa-kdb/ipa_kdb_common.c +++ b/daemons/ipa-kdb/ipa_kdb_common.c @@ -21,6 +21,7 @@ */ #include "ipa_kdb.h" +#include <unicase.h> static struct timeval std_timeout = {300, 0}; @@ -518,20 +519,28 @@ int ipadb_ldap_attr_to_krb5_timestamp(LDAP *lcontext, LDAPMessage *le, } int ipadb_ldap_attr_has_value(LDAP *lcontext, LDAPMessage *le, - char *attrname, char *value) + char *attrname, const char *value) { struct berval **vals; int ret = ENOENT; - int i; + int i, result; vals = ldap_get_values_len(lcontext, le, attrname); if (vals) { for (i = 0; vals[i]; i++) { - if (strcasecmp(vals[i]->bv_val, value) == 0) { + if (ulc_casecmp(vals[i]->bv_val, vals[i]->bv_len, + value, strlen(value), + NULL, NULL, &result) != 0) { + ret = errno; + break; + } + + if (result == 0) { ret = 0; break; } } + ldap_value_free_len(vals); } |