Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-07-14 17:33:20 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-07-14 17:33:20 +0400
commit6aafa0bfc236fe69ecc5286b0d57a8987b0e7bef (patch)
treebd44574653e60488819dd88e1c1f3cd474e02357 /winsup/cygwin/uinfo.cc
parent4866e86cb116499c04d6ca2e381d883867879a55 (diff)
* uinfo.cc (cygheap_domain_info::init): Correctly set
lowest_tdo_posix_offset to UNIX_POSIX_OFFSET. (fetch_posix_offset): Redesign to fake a POSIX offset in all cases where we can't fetch a non-0 POSIX offset from our primary domain.
Diffstat (limited to 'winsup/cygwin/uinfo.cc')
-rw-r--r--winsup/cygwin/uinfo.cc32
1 files changed, 15 insertions, 17 deletions
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index cc757f9fe..b9d893794 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -815,8 +815,9 @@ cygheap_domain_info::init ()
lsa_close_policy (lsa);
if (cygheap->dom.member_machine ())
{
- /* For a domain member machine fetch all trusted domain info. */
- lowest_tdo_posix_offset = UNIX_POSIX_OFFSET - 1;
+ /* For a domain member machine fetch all trusted domain info.
+ Start out with UNIX_POSIX_OFFSET. */
+ lowest_tdo_posix_offset = UNIX_POSIX_OFFSET;
ret = DsEnumerateDomainTrustsW (NULL, DS_DOMAIN_DIRECT_INBOUND
| DS_DOMAIN_DIRECT_OUTBOUND
| DS_DOMAIN_IN_FOREST,
@@ -1137,27 +1138,24 @@ pwdgrp::fetch_account_from_file (fetch_user_arg_t &arg)
static ULONG
fetch_posix_offset (PDS_DOMAIN_TRUSTSW td, cyg_ldap *cldap)
{
- uint32_t id_val;
+ uint32_t id_val = 0;
if (!td->PosixOffset && !(td->Flags & DS_DOMAIN_PRIMARY) && td->DomainSid)
{
- if (cldap->open (NULL) != NO_ERROR)
- {
- /* We're probably running under a local account, so we're not allowed
- to fetch any information from AD beyond the most obvious. Never
- mind, just fake a reasonable posix offset. */
- id_val = cygheap->dom.lowest_tdo_posix_offset
- - 0x01000000;
- }
- else
+ if (cldap->open (NULL) == NO_ERROR)
id_val = cldap->fetch_posix_offset_for_domain (td->DnsDomainName);
- if (id_val)
+ if (!id_val)
{
- td->PosixOffset = id_val;
- if (id_val < cygheap->dom.lowest_tdo_posix_offset)
- cygheap->dom.lowest_tdo_posix_offset = id_val;
-
+ /* We're probably running under a local account, so we're not allowed
+ to fetch any information from AD beyond the most obvious.
+ Alternatively we're suffering IT madness and some admin has
+ actually set the POSIX offset to 0. Either way, fake a reasonable
+ posix offset and hope for the best. */
+ id_val = cygheap->dom.lowest_tdo_posix_offset - 0x00800000;
}
+ td->PosixOffset = id_val;
+ if (id_val < cygheap->dom.lowest_tdo_posix_offset)
+ cygheap->dom.lowest_tdo_posix_offset = id_val;
}
return td->PosixOffset;
}