known BUG "multi-byte character set in usernames"
Juergen Hasch
Hasch at t-online.de
Sun Jun 2 10:51:02 GMT 2002
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.
This patch works for me, I can see all umlaute, see/set them under Linux and
Windows. I am really happy with this :-)
...Juergen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: charset_patch_1
Type: text/x-diff
Size: 12966 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20020602/f612da72/charset_patch_1.bin
More information about the samba-technical
mailing list