[PATCH] Allow . to end a filename, use real unicode for fnmatch().

Andrew Bartlett abartlet at samba.org
Sun Jul 27 05:20:56 GMT 2003


On Wed, 2003-07-23 at 00:24, Andrew Bartlett wrote:
> After being pointed at bug #205, I've knocked up a patch to deal with
> some more multibyte issues:

Our current fnmatch() code goes to great lengths to use unicode -
however, the way the strings are copied into it, it really is just 'skip
every second character' unicode.  There is no actual conversion being
done, and the result for some unix charsets must be disgusting!

Furthermore, the old codes makes a unicode conversion - but only for the
purpose of strupper_m(), and throws that away again.

The idea of this patch is to do one unicode conversion per string, and
to do the case-insensitive stuff in the actual fnmatch internals, where
we can do it in the comparison, rather than over the entire string.

In testing this patch however, I noticed that our mangling code was
refusing to allow filenames that end in '.'   This caused us to fail our
own tests (or the Samba 2.2 tests actually).

So, I tested Win2k - and it allows filenames to end in .  (as in
'foo.'), so I've removed this part of the code.

> The fnmatch code is untested, as is the change to push_ucs2 (to make it cope
> with this situation for the STR_UPPER flag).

With the change to the mangling system, this patch passes Samba 2.2's
masktest, and the push_ucs2 stuff is already applied.

> StrCaseCmp is again tested with the software test framework.

These changes have been applied.

Andrew Bartlett

-- 
Andrew Bartlett                                 abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team  abartlet at samba.org
Student Network Administrator, Hawker College   abartlet at hawkerc.net
http://samba.org     http://build.samba.org     http://hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20030727/401559a5/attachment.bin


More information about the samba-technical mailing list