public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Denis Excoffier <cygwin@Denis-Excoffier.org>
To: cygwin@cygwin.com
Subject: Re: timeout in LDAP access
Date: Sat, 12 Jul 2014 13:39:00 -0000	[thread overview]
Message-ID: <BA09D7D8-96E6-431F-9434-8BA8A2AB4952@Denis-Excoffier.org> (raw)
In-Reply-To: <20140709101256.GD26447@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 778 bytes --]

On 2014-07-09 12:12 Corinna Vinschen wrote:
>> 
>> I have encountered this case in real life. The domain admins have set
>> the trustPosixOffset of the secondary domain to zero. This value is therefore
>> never recorded and the cldap->open occurs again and again.
> 
> Ouch.  Why on earth are admins doing this?  There's no way to
> workaround this reliably.
> 
Reliably i don’t know. I’ve modified uinfo.cc in order that the special value
for td->PosixOffset is no longer 0. Taking into account that LDAP_SERVER_DOWN
is now recognized, my ‘getent passwd’ executes gracefully in 40 minutes
(instead of 60) and ‘getent group’ in 25 minutes (instead of 90). Also quicker
is ‘mkpasswd -d secondary_domain’ of course. Patch attached.

Regards,

Denis Excoffier.


[-- Attachment #2: posixoffset.patch --]
[-- Type: application/octet-stream, Size: 1877 bytes --]

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;
 }


[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2014-07-12 13:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 20:39 Denis Excoffier
2014-06-17 10:00 ` Corinna Vinschen
2014-06-17 10:30   ` gecos from AD? (was Re: timeout in LDAP access) Corinna Vinschen
2014-06-17 12:51     ` Corinna Vinschen
2014-06-17 23:07       ` Denis Excoffier
2014-06-18  2:18       ` AW: " Christoph H. Hochstaetter
2014-06-17 22:59     ` Denis Excoffier
2014-06-18  8:38       ` Corinna Vinschen
2014-06-17 22:41   ` timeout in LDAP access Denis Excoffier
2014-06-18  8:33     ` Corinna Vinschen
2014-06-18 18:01       ` Corinna Vinschen
2014-06-19 17:53         ` Denis Excoffier
2014-06-23  9:10           ` Corinna Vinschen
2014-06-23 20:38             ` Denis Excoffier
2014-06-24 15:59               ` Corinna Vinschen
2014-06-25 10:15                 ` Corinna Vinschen
2014-06-25 20:44                   ` Denis Excoffier
2014-06-25 21:14                     ` Corinna Vinschen
2014-07-03 20:57                       ` Denis Excoffier
2014-07-07 11:07                         ` Corinna Vinschen
2014-07-08 19:34                           ` Denis Excoffier
2014-07-09 10:13                             ` Corinna Vinschen
2014-07-12 13:39                               ` Denis Excoffier [this message]
2014-07-14  9:51                                 ` Corinna Vinschen
2014-07-14 13:48                                   ` Corinna Vinschen
2014-07-15 16:29                                     ` Denis Excoffier
2014-07-15 18:20                                       ` Andrey Repin
2014-07-16 13:52                                       ` Corinna Vinschen
2014-07-17  6:33                                         ` Denis Excoffier
2014-07-18 19:18                                           ` Corinna Vinschen
2014-07-28  9:21                                             ` Corinna Vinschen
2014-07-28 18:51                                               ` Denis Excoffier
2014-07-29  9:07                                                 ` Please test AD integration changes, documentation attached (was Re: timeout in LDAP access) Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BA09D7D8-96E6-431F-9434-8BA8A2AB4952@Denis-Excoffier.org \
    --to=cygwin@denis-excoffier.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).