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)
commit9918fa73145a22b1d7adf001f0a9cf0e1bda4136
treeb68f614431ad311e18f33901abcb6ff9a1614e50
parentb65fe75bec8170ad48d1ad0a9017ccc4de651eba
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
source/lib/util_str.c