svn commit: samba r18978 - in
branches/SAMBA_4_0/source/lib/ldb/common: .
abartlet at samba.org
abartlet at samba.org
Thu Sep 28 17:06:39 GMT 2006
Author: abartlet
Date: 2006-09-28 17:06:38 +0000 (Thu, 28 Sep 2006)
New Revision: 18978
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=18978
Log:
Fix bug found by:
http://www.ee.oulu.fi/research/ouspg/protos/testing/c06/ldapv3/
The issue here is that if the UTF8 conversion fails, because this
isn't actually UTF8 data, then we need to do a binary compare instead.
Andrew Bartlett
Modified:
branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c 2006-09-28 16:58:28 UTC (rev 18977)
+++ branches/SAMBA_4_0/source/lib/ldb/common/attrib_handlers.c 2006-09-28 17:06:38 UTC (rev 18978)
@@ -184,10 +184,19 @@
return (int)(toupper(*s1)) - (int)(toupper(*s2));
utf8str:
- /* non need to recheck from the start, just from the first utf8 char found */
+ /* no need to recheck from the start, just from the first utf8 char found */
b1 = u1 = ldb_casefold(ldb, mem_ctx, s1);
b2 = u2 = ldb_casefold(ldb, mem_ctx, s2);
-
+
+ if (u1 && u2) {
+ /* Both strings converted correctly */
+ } else {
+ /* One of the strings was not UTF8, so we have no options but to do a binary compare */
+
+ u1 = s1;
+ u2 = s2;
+ }
+
while (*u1 & *u2) {
if (*u1 != *u2)
break;
@@ -202,9 +211,10 @@
while (*u2 == ' ') u2++;
}
ret = (int)(*u1 - *u2);
+
talloc_free(b1);
talloc_free(b2);
-
+
return ret;
}
More information about the samba-cvs
mailing list