--- /dev/null
+If we were supposed to set ERANGE, do so again, in case do_close() or
+_nss_ldap_leave() overwrote errno with some other value. Upstream #421.
+
+diff -up nss_ldap-265/ldap-nss.ce nss_ldap-265/ldap-nss.c
+--- nss_ldap-265/ldap-nss.ce 2010-07-08 16:17:07.000000000 -0400
++++ nss_ldap-265/ldap-nss.c 2010-07-08 16:17:03.000000000 -0400
+@@ -3572,6 +3572,10 @@ _nss_ldap_getbyname (ldap_args_t * args,
+
+ debug ("<== _nss_ldap_getbyname");
+
++ /* at least for the cases where we know we have to return ERANGE */
++ if (stat == NSS_TRYAGAIN)
++ do_map_errno(stat, errnop);
++
+ return stat;
+ }
+