summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-09-20 07:31:54 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:53 -0500
commitf2815e8412e629e426832ce60457a0f3fec85e4c (patch)
treecf1de48a60418d517ee4b110c100c3665f628418 /source4
parent8a1c3ddd947039bf3b62efd94d3429359b593e15 (diff)
downloadsamba-f2815e8412e629e426832ce60457a0f3fec85e4c.tar.gz
samba-f2815e8412e629e426832ce60457a0f3fec85e4c.tar.bz2
samba-f2815e8412e629e426832ce60457a0f3fec85e4c.zip
r2437: implemented a suggestion from abartlet that if we cannot convert
strings to UTF16 in StrCaseCmp() that we fall back to a simpler comparison. (This used to be commit 2fa6ab9fe30aeacd7b1421fd83c409acf31c98aa)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/util_str.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/lib/util_str.c b/source4/lib/util_str.c
index 961bdb8084..3fe6fd1cc0 100644
--- a/source4/lib/util_str.c
+++ b/source4/lib/util_str.c
@@ -123,8 +123,11 @@ static int StrCaseCmp_slow(const char *s1, const char *s2)
smb_ucs2_t *u1, *u2;
int ret;
- convert_string_allocate(CH_UNIX, CH_UTF16, s1, strlen(s1)+1, &u1);
- convert_string_allocate(CH_UNIX, CH_UTF16, s2, strlen(s2)+1, &u2);
+ if (convert_string_allocate(CH_UNIX, CH_UTF16, s1, strlen(s1)+1, &u1) == -1 ||
+ convert_string_allocate(CH_UNIX, CH_UTF16, s2, strlen(s2)+1, &u2) == -1) {
+ /* fallback to a simple comparison */
+ return strcasecmp(s1, s2);
+ }
ret = strcasecmp_w(u1, u2);