uni_full_name and uni_acct_desc in SAM_USER_INFO_21 swapped?

Toomas Soome tsoome at ut.ee
Tue Feb 20 19:42:41 GMT 2001


On Tue, 20 Feb 2001, Jim McDonough wrote:

> I was trying to get Full Name to show up on User Manager for domains, on
> both NT4 and 2K, so I added some code to get_passwd_entries in srv_samr.c.
> However, when I used uni_full_name, that text showed up in the
> "Description" column, and uni_acct_desc text showed up in the "Full Name"
> column in usrmgr.exe.  Is it possible these two fields are swapped?

I suggest strongly, do not use any unix specific getsp* or getpw*
functions outside passdb modules. if you are missing data - fill the
structure fields in passdb and use passdb api.

>
> Here's the code I added to srv_samr.c:
>
> --- ../../../../orig/samba-2.2/source/rpc_server/srv_samr.c  Tue Feb 20
> 11:50:02 2001
> +++ ./srv_samr.c    Tue Feb 20 11:30:07 2001
> @@ -278,6 +284,7 @@
>      /* now current_idx == start_idx */
>      while ((*num_entries) < max_num_entries) {
>           int user_name_len;
> +         int full_name_len;
>           char *unmap_name;
>
>           /* This does the original UNIX user itself */
> @@ -291,6 +298,7 @@
>                }
>
>                user_name_len = strlen(pwd->pw_name);
> +              full_name_len = strlen(pwd->pw_gecos);
>
>                /* skip the trust account stored in the /etc/passwd file */
>                if (pwd->pw_name[user_name_len-1]=='$')
> @@ -300,6 +308,11 @@
>                ZERO_STRUCTP(&pw_buf[(*num_entries)]);
>                init_unistr2(&(pw_buf[(*num_entries)].uni_user_name),
> pwd->pw_name, user_name_len);
>                init_uni_hdr(&(pw_buf[(*num_entries)].hdr_user_name),
> user_name_len);
> +              if (full_name_len) {
> +                init_unistr2(&(pw_buf[(*num_entries)].uni_acct_desc),
> pwd->pw_gecos, full_name_len);
> +                init_uni_hdr(&(pw_buf[(*num_entries)].hdr_acct_desc),
> full_name_len);
> +              }
> +
>                pw_buf[(*num_entries)].user_rid = pw_rid;
>                memset((char *)pw_buf[(*num_entries)].nt_pwd, '\0', 16);
>
>
> ----------------------------
> Jim McDonough
> Linux Technology Center
> IBM Boulder
>
> Notes: Jim McDonough/Boulder/IBM @ IBMUS
> VNET: JMCD at IBMUSM54
> Internet: jmcd at us.ibm.com
>
> Phone: (303) 924-5822
> T/L: 263-5822
>
>

toomas
-- 
Nuke the unborn gay female whales for Jesus.





More information about the samba-technical mailing list