* uinfo.cc (pwdgrp::fetch_account_from_windows): Add code to allow
setting the primary group from the SAM comment field.
This commit is contained in:
parent
127cfd4f5a
commit
0ac645c1c3
|
@ -1,3 +1,8 @@
|
|||
2014-02-10 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* uinfo.cc (pwdgrp::fetch_account_from_windows): Add code to allow
|
||||
setting the primary group from the SAM comment field.
|
||||
|
||||
2014-02-10 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* dcrt0.cc (child_info_spawn::handle_spawn): Call fixup_lockf_after_exec
|
||||
|
|
|
@ -1443,6 +1443,7 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
|||
debug_printf ("NetUserGetInfo(%W,%W) %u", domain, name, nas);
|
||||
else
|
||||
{
|
||||
PWCHAR pgrp = NULL;
|
||||
struct {
|
||||
PCWSTR str;
|
||||
size_t len;
|
||||
|
@ -1450,7 +1451,8 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
|||
} search[] = {
|
||||
{ L"name=\"", 6, &user },
|
||||
{ L"home=\"", 6, &home },
|
||||
{ L"shell=\"", 7, &shell }
|
||||
{ L"shell=\"", 7, &shell },
|
||||
{ L"group=\"", 7, &pgrp }
|
||||
};
|
||||
PWCHAR s, e;
|
||||
|
||||
|
@ -1494,6 +1496,25 @@ pwdgrp::fetch_account_from_windows (fetch_user_arg_t &arg, bool group)
|
|||
}
|
||||
}
|
||||
NetApiBufferFree (ui);
|
||||
if (pgrp)
|
||||
{
|
||||
/* For setting the primary group, we have to test all
|
||||
three possible Cygwin name variations:
|
||||
|
||||
MACHINE+group, +group, group
|
||||
*/
|
||||
char gname[2 * (DNLEN + UNLEN + 1)];
|
||||
char *sep;
|
||||
struct group *gr;
|
||||
|
||||
sep += sys_wcstombs (sep = gname, 2 * DNLEN + 1, domain);
|
||||
*sep = cygheap->pg.nss_separator ()[0];
|
||||
sys_wcstombs (sep + 1, 2 * UNLEN + 1, pgrp);
|
||||
if ((gr = internal_getgrnam (gname))
|
||||
|| (gr = internal_getgrnam (sep))
|
||||
|| (gr = internal_getgrnam (sep + 1)))
|
||||
gid = gr->gr_gid;
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* SidTypeGroup */
|
||||
|
|
Loading…
Reference in New Issue