diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 319b31b8860fef9c2025a93950a4d293179492ff..460b199f1f17acbfe75bbb796c893edf9970942d 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -671,7 +671,7 @@ static int dosearch( char *value) { char filter[ BUFSIZ ]; - int rc, first, matches; + int rc, first, matches, err; LDAPMessage *res, *e; if( filtpatt != NULL ) { @@ -721,7 +721,8 @@ static int dosearch( ldap_perror( ld, "ldap_result" ); return( rc ); } - if (( rc = ldap_result2error( ld, res, 0 )) != LDAP_SUCCESS ) { + rc = ldap_parse_result( ld, res, &err, NULL, NULL, NULL, NULL, 0 ); + if ( rc != LDAP_SUCCESS || rc != LDAP_SUCCESS ) { ldap_perror( ld, "ldap_search" ); } if ( sortattr != NULL ) {