diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e9c2e1455..1b9574050 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,8 @@ +2014-02-10 Corinna Vinschen + + * uinfo.cc (cygheap_domain_info::init): Fix handling of account domain + on donmain controllers. Explain why. + 2014-02-10 Corinna Vinschen * cygheap.cc (cwcsdup): Change parameter to correct PWCSTR. diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index e209cc66c..1e54d3956 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -745,9 +745,13 @@ cygheap_domain_info::init () system_printf ("LsaQueryInformationPolicy(Account) %u", status); return false; } - /* Copy account domain info to cygheap. */ - adom_name = cwcsdup (adom->DomainName.Buffer); + /* Copy account domain info to cygheap. If we're running on a DC the account + domain is identical to the primary domain. This leads to confusion when + trying to compute the uid/gid values. Therefore we invalidate the account + domain name if we're running on a DC. */ adom_sid = adom->DomainSid; + if (pdom_sid == adom_sid) + adom_name = cwcsdup (pdom_sid == adom_sid ? L"@" : adom->DomainName.Buffer); LsaFreeMemory (adom); lsa_close_policy (lsa); if (cygheap->dom.member_machine ())