diff -urN src.orig/lookups/ldap.c src/lookups/ldap.c --- src.orig/lookups/ldap.c Tue Oct 5 11:32:08 2004 +++ src/lookups/ldap.c Sat Nov 20 21:05:00 2004 @@ -748,7 +748,8 @@ with the search. The message must be an LDAP_RES_SEARCH_RESULT or else it's something we can't handle. */ -if (rc != LDAP_RES_SEARCH_RESULT) +//if (rc != LDAP_RES_SEARCH_RESULT) +if ((rc != LDAP_RES_SEARCH_RESULT) && (rc != LDAP_RES_SEARCH_REFERENCE)) { *errmsg = string_sprintf("ldap_result returned unexpected code %d", rc); goto RETURN_ERROR; @@ -757,14 +758,24 @@ /* We have a result message from the server. This doesn't yet mean all is well. We need to parse the message to find out exactly what's happened. */ - #if defined LDAP_LIB_SOLARIS || defined LDAP_LIB_OPENLDAP2 - if (ldap_parse_result(lcp->ld, result, &rc, CSS &matched, CSS &error2, NULL, - NULL, 0) < 0) +#if defined LDAP_LIB_SOLARIS || defined LDAP_LIB_OPENLDAP2 +{ + int ldap_rc, ldap_parse_rc; + ldap_rc = rc; + ldap_parse_rc = ldap_parse_result(lcp->ld, result, &rc, CSS &matched, CSS &error2, NULL, + NULL, 0); +DEBUG(D_lookup) debug_printf("ldap_parse_result: %d: %s\n", ldap_parse_rc); + if ((ldap_parse_rc < 0) && + (!((ldap_parse_rc == LDAP_NO_RESULTS_RETURNED) && (ldap_rc == LDAP_RES_SEARCH_REFERENCE)))) +{ { +DEBUG(D_lookup) debug_printf("ldap_parse_result failed %d: %s\n", ldap_parse_rc); *errmsg = US"ldap_parse_result failed"; goto RETURN_ERROR; } error1 = US ldap_err2string(rc); +} +} #elif defined LDAP_LIB_NETSCAPE /* Dubious (it doesn't reference 'result' at all!) */