--- ../libpam-ldap-180/pam_ldap.c	2008-04-15 14:45:59.000000000 -0400
+++ pam_ldap.c	2008-04-15 14:44:58.000000000 -0400
@@ -2484,6 +2484,7 @@
 _get_user_info (pam_ldap_session_t * session, const char *user)
 {
   char filter[LDAP_FILT_MAXSIZ], escapedUser[LDAP_FILT_MAXSIZ];
+	char *test_attrs[] = { session->conf->userattr, NULL };
   int rc;
   LDAPMessage *res, *msg;
   pam_ssd_t *ssd, ssdummy;
@@ -2538,7 +2539,7 @@
     }
 
   rc = ldap_search_s (session->ld, ssd->base, ssd->scope,
-		      filter, NULL, 0, &res);
+					filter, test_attrs, 0, &res);
 
   if (rc != LDAP_SUCCESS &&
       rc != LDAP_TIMELIMIT_EXCEEDED && rc != LDAP_SIZELIMIT_EXCEEDED)
