mb strings

Jeremy Allison jallison at whistle.com
Wed May 20 10:45:33 EST 1998

Andrew Tridgell wrote:

> > This should be fixable (I'll take a look at it). For the moment I
> > don't think leaving the multibyte functions in strlower and strupper
> > will do harm, as it's only when an asian code page is selected that
> > any characters will be skipped.
> I'm not quite sure what the consequences are for those people, but I
> have a nasty feeling that it might breaks things. We use strlower in
> the authentication routines (for example) to handle mixed case
> passwords and usernames.

Well if the passwords and usernames are sent from the
client then they will already be in the client code page,
in which case we *do* want to skip the multibyte characters
when doing upper/lower case conversion on these strings
(multibyte chars don't convert case).

The only time it may break things is if the multibyte skipping
strlower/strupper is called on a string that was not from the
client, and is in fact in the code page of the UNIX machine
(usually EUC in Asian language cases). 

In order to deal with this we need to call our old strupper
and strlower functions (without the client code page multibyte
escapes) for these strings. Once we've called setlocale()
(in charset.c) then the toupper/tolower macros do the right
thing automatically.

Either way we need to skip the multibyte chars, it's just
which function we call to do the upper to lower (and vica
versa conversion), depending on whether the string was host 
or client generated.

To do this properly means going through all the code and
determining if the source is client or server, and changing
the strlower/strupper calls accordingly.

Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.

More information about the samba-cvs mailing list