known BUG "multi-byte character set in usernames"

Jeremy Allison jra at samba.org
Wed Jun 5 14:49:13 GMT 2002


On Sun, Jun 02, 2002 at 07:44:02PM +0200, Juergen Hasch wrote:
> Hi Jerry,
> Am Sonntag, 2. Juni 2002 03:15 schrieb Gerald Carter:
> > On Fri, 31 May 2002, Juergen Hasch wrote:
> > > Now I never would have brought this up because I don't care to much for
> > > 2.2 and I was just curious when I made the patches. But since someone
> > > asked :-) The names/groups are transferred by rpc and converted from
> > > unicode like this: unistr2_to_ascii(t, &info1.str[j].uni_acct_name,
> > > sizeof(pstring)); Adding the line
> > > 	dos_to_unix(t);
> > > makes the umlaute appear.
> > > Now the charset conversion may be totally wrong there, I believed it to
> > > be *easiest* patch.
> >
> > please send me thispatch for 2.2 if you ave it.  Thanks.
> 
> I believe the most simple patch would be:
> 
> --- lib/util_unistr.c.orig      Tue Apr  2 18:27:59 2002
> +++ lib/util_unistr.c   Sun Jun  2 14:01:57 2002
> @@ -311,7 +311,7 @@
> 
>  /*******************************************************************
>   Convert a (little-endian) UNISTR2 structure to an ASCII string
> - Warning: this version does DOS codepage.
> + Warning: this version does UNIX codepage.
>  ********************************************************************/
> 
>  void unistr2_to_ascii(char *dest, const UNISTR2 *str, size_t maxlen)
> @@ -335,7 +335,7 @@
> 
>         for (p = dest; (p-dest < maxlen-3) && (src - str->buffer < 
> str->uni_str_len) && *src; src++) {
>                 uint16 ucs2_val = SVAL(src,0);
> -               uint16 cp_val = ucs2_to_doscp[ucs2_val];
> +               uint16 cp_val = ucs2_to_unixcp[ucs2_val];
> 
>                 if (cp_val < 256)
>                         *p++ = (char)cp_val;
> 
> However, unistr2_to_ascii is used in the printing stuff, too and I don't want 
> to mess with this mess :-)
> A less radical patch is attached therefore, adding a new function 
> unistr2_to_unix which returns the unix charset instead of the dos codepage.
> Also unistr2_tdup is changed to call unistr2_to_unix. It is only used in 
> nsswitch/winbind_rpc.c.

I've just committed a modified version of this patch to SAMBA_2_2,
if you could test it out I'd appreciate it.

Thanks a *lot* for this patch !

Jeremy.




More information about the samba-technical mailing list