svn commit: samba r2437 - in branches/SAMBA_4_0/source/lib: .

tridge at samba.org tridge at samba.org
Mon Sep 20 07:31:55 GMT 2004


Author: tridge
Date: 2004-09-20 07:31:54 +0000 (Mon, 20 Sep 2004)
New Revision: 2437

WebSVN: http://websvn.samba.org/websvn/changeset.php?rep=samba&path=/branches/SAMBA_4_0/source/lib&rev=2437&nolog=1

Log:
implemented a suggestion from abartlet that if we cannot convert
strings to UTF16 in StrCaseCmp() that we fall back to a simpler
comparison.

Modified:
   branches/SAMBA_4_0/source/lib/util_str.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/util_str.c
===================================================================
--- branches/SAMBA_4_0/source/lib/util_str.c	2004-09-20 07:28:43 UTC (rev 2436)
+++ branches/SAMBA_4_0/source/lib/util_str.c	2004-09-20 07:31:54 UTC (rev 2437)
@@ -123,8 +123,11 @@
 	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);
 



More information about the samba-cvs mailing list