diff -uNr cygwin-snapshot-20140709-1-o/winsup/cygwin/uinfo.cc cygwin-snapshot-20140709-1-p/winsup/cygwin/uinfo.cc --- cygwin-snapshot-20140709-1-o/winsup/cygwin/uinfo.cc 2014-07-09 14:10:50.000000000 +0200 +++ cygwin-snapshot-20140709-1-p/winsup/cygwin/uinfo.cc 2014-07-11 13:16:07.671916100 +0200 @@ -35,6 +35,8 @@ #include "ldap.h" #include "cygserver_pwdgrp.h" +#define CYG_LDAP_IMPROBABLE_POSIXOFFSET 1111111111 /* 0 would be too probable */ + /* Initialize the part of cygheap_user that does not depend on files. The information is used in shared.cc for the user shared. Final initialization occurs in uinfo_init */ @@ -853,8 +855,9 @@ tdom[idx].DomainSid = cmalloc_abort(HEAP_BUF, len); RtlCopySid (len, tdom[idx].DomainSid, td[idx].DomainSid); } - /* ...and set PosixOffset to 0. This */ - tdom[idx].PosixOffset = 0; + /* ...and set PosixOffset to CYG_LDAP_IMPROBABLE_POSIXOFFSET to mean + that the offset is still to be fetched */ + tdom[idx].PosixOffset = CYG_LDAP_IMPROBABLE_POSIXOFFSET; } NetApiBufferFree (td); tdom_count = tdom_cnt; @@ -1139,7 +1142,7 @@ { uint32_t id_val; - if (!td->PosixOffset && !(td->Flags & DS_DOMAIN_PRIMARY) && td->DomainSid) + if (td->PosixOffset == CYG_LDAP_IMPROBABLE_POSIXOFFSET && !(td->Flags & DS_DOMAIN_PRIMARY) && td->DomainSid) { if (cldap->open (NULL) != NO_ERROR) { @@ -1151,13 +1154,14 @@ } else id_val = cldap->fetch_posix_offset_for_domain (td->DnsDomainName); - if (id_val) + if (id_val != CYG_LDAP_IMPROBABLE_POSIXOFFSET) { td->PosixOffset = id_val; if (id_val < cygheap->dom.lowest_tdo_posix_offset) cygheap->dom.lowest_tdo_posix_offset = id_val; } + debug_printf ("computing PosixOffset for domain %W, found %u", td->DnsDomainName, td->PosixOffset); } return td->PosixOffset; }