oh. sorry, should have gone to the list...

bye,
guenther

----- Forwarded message from Guenther Deschner <[EMAIL PROTECTED]> -----

Date: Sun, 2 Jun 2002 12:50:23 +0200
From: Guenther Deschner <[EMAIL PROTECTED]>
To: Gerald Carter <[EMAIL PROTECTED]>
Subject: Re: known BUG "multi-byte character set in usernames"
User-Agent: Mutt/1.4i
X-Operating-System: Linux 2.4.18-4GB i686

hi gerry,

On Sat, Jun 01, 2002 at 08:15:21PM -0500, Gerald Carter wrote:
> 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.

well, here is at least my slightly modified version of juergens patch 
against CVS 2_2. 

it still lacks support to resolve names containing "umlaute" to gids/sids 
i cannot chgrp to e.g. MYDOMAIN+Dom�nen-Admins on linux, while it works 
fine now from the security tab. the "umlaute" do appear everywhere. 
thanks juergen!

it would be great if this could be solved for 2.2.5.

bye,
guenther
----- End forwarded message -----

-- 
Guenther Deschner                          [EMAIL PROTECTED]
SuSE Linux AG                                        GnuPG: 8EE11688
Berliner Str. 27                      phone:  +49 (0) 30 / 430944778
D-13507 Berlin                           fax:  +49 (0) 30 / 43732804
--- source/nsswitch/winbindd_rpc.c      Thu May 30 16:25:50 2002
+++ source/nsswitch/winbindd_rpc.c      Sat May 25 23:49:43 2002
@@ -63,7 +63,7 @@
                uint32 count = 0, start=i;
                int j;
                TALLOC_CTX *ctx2;
-
+               pstring t;
                ctr.sam.info1 = &info1;
 
                ctx2 = talloc_init_named("winbindd dispinfo");
@@ -92,8 +92,14 @@
                }
 
                for (j=0;j<count;i++, j++) {
-                       (*info)[i].acct_name = unistr2_tdup(mem_ctx, 
&info1.str[j].uni_acct_name);
-                       (*info)[i].full_name = unistr2_tdup(mem_ctx, 
&info1.str[j].uni_full_name);
+                       unistr2_to_ascii(t, &info1.str[j].uni_acct_name, 
+sizeof(pstring));
+                       dos_to_unix(t);
+                       (*info)[i].acct_name = talloc_strdup(mem_ctx, t);
+                       
+                       unistr2_to_ascii(t, &info1.str[j].uni_full_name, 
+sizeof(pstring));
+                       dos_to_unix(t);
+                       (*info)[i].full_name = talloc_strdup(mem_ctx, t);
+                       
                        (*info)[i].user_rid = info1.sam[j].rid_user;
                        /* For the moment we set the primary group for
                           every user to be the Domain Users group.
@@ -267,6 +273,7 @@
        POLICY_HND dom_pol, user_pol;
        BOOL got_dom_pol = False, got_user_pol = False;
        SAM_USERINFO_CTR *ctr;
+       pstring t;
 
        /* Get sam handle */
        if (!(hnd = cm_get_sam_handle(domain->name)))
@@ -300,10 +307,15 @@
        got_user_pol = False;
 
        user_info->group_rid = ctr->info.id21->group_rid;
-       user_info->acct_name = unistr2_tdup(mem_ctx, 
-                                           &ctr->info.id21->uni_user_name);
-       user_info->full_name = unistr2_tdup(mem_ctx, 
-                                           &ctr->info.id21->uni_full_name);
+       
+       unistr2_to_ascii(t, &ctr->info.id21->uni_user_name, sizeof(pstring));
+       dos_to_unix(t);
+       user_info->acct_name = talloc_strdup(mem_ctx, t);
+       
+       unistr2_to_ascii(t, &ctr->info.id21->uni_full_name, sizeof(pstring));
+       dos_to_unix(t);
+       user_info->full_name = talloc_strdup(mem_ctx, t);
+
 
  done:
        /* Clean up policy handles */
--- source/libsmb/cli_samr.c    Thu May 30 16:30:33 2002
+++ source/libsmb/cli_samr.c    Sat May 25 23:30:51 2002
@@ -569,6 +569,7 @@
                        unistr2_to_ascii((*dom_groups)[i].acct_name,
                                         &r.uni_grp_name[name_idx],
                                         sizeof(fstring) - 1);
+                       dos_to_unix((*dom_groups)[i].acct_name);
                        name_idx++;
                }
 
@@ -647,6 +648,7 @@
                        unistr2_to_ascii((*dom_groups)[i].acct_name,
                                         &r.uni_grp_name[name_idx],
                                         sizeof(fstring) - 1);
+                       dos_to_unix((*dom_groups)[i].acct_name);
                        name_idx++;
                }
 
@@ -938,6 +940,7 @@
                fstring tmp;
 
                unistr2_to_ascii(tmp, &r.uni_name[i], sizeof(tmp) - 1);
+               dos_to_unix(tmp);
                (*names)[i] = talloc_strdup(mem_ctx, tmp);
                (*name_types)[i] = r.type[i];
        }
--- source/rpcclient/cmd_samr.c Sun Apr  7 10:10:35 2002
+++ source/rpcclient/cmd_samr.c Thu May 30 16:38:36 2002
@@ -35,9 +35,11 @@
        fstring temp;
 
        unistr2_to_ascii(temp, &usr->uni_user_name, sizeof(temp)-1);
+       dos_to_unix(temp);
        printf("\tUser Name   :\t%s\n", temp);
        
        unistr2_to_ascii(temp, &usr->uni_full_name, sizeof(temp)-1);
+       dos_to_unix(temp);
        printf("\tFull Name   :\t%s\n", temp);
        
        unistr2_to_ascii(temp, &usr->uni_home_dir, sizeof(temp)-1);
--- source/nsswitch/winbindd_util.c     Fri May 17 16:12:36 2002
+++ source/nsswitch/winbindd_util.c     Fri May 31 15:27:44 2002
@@ -281,6 +281,7 @@
        if ((rv = NT_STATUS_IS_OK(result))) {
                fstrcpy(dom_name, domain->name);
                fstrcpy(name, names);
+               dos_to_unix(name);
        } else {
                *type = SID_NAME_UNKNOWN;
                fstrcpy(name, name_deadbeef);

Attachment: msg01167/pgp00000.pgp
Description: PGP signature

Reply via email to