Fix StrCaseCmp() to avoid calling smb_panic() on invalid multibyte strings.
authorAndrew Bartlett <abartlet@samba.org>
Sat, 19 Jul 2003 00:36:43 +0000 (00:36 +0000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 19 Jul 2003 00:36:43 +0000 (00:36 +0000)
commite45b66ba8a6b6fd669ce7b4f9f8f84f9c26e1575
treed2e2aee395ac04d8687f0d28361b80c8d5fffc1f
parentfb56f58fbc78efbfa6e5a552946ab792e45380a1
Fix StrCaseCmp() to avoid calling smb_panic() on invalid multibyte strings.

This fix results in
 - we no longer use fixed-size buffers in StrCaseCmp (previously limited to
   a pstring)
 - we return strcmp(s, t) if either of the strings is invalid
 - for non-ascii cases, we call iconv twice, not 4 times.

The basic idea with this fix is that if a string is not valid in the currnet
charset, then (unless it is byte-equivilant) it cannot be case-equivilant
to any other string.

This should address the majority of our smb_panic() cases on this matter.  It
will not fix them all - we still call unix_strupper(), aka strupper_m()
elsewhere, but this was being called on every file in the directory when
we performed unix_convert().

Tested with the stf unit tests for this routine.

Andrew Bartlett
(This used to be commit 9918fa73145a22b1d7adf001f0a9cf0e1bda4136)
source3/lib/util_str.c