getentry.c: LDAP_RES_SEARCH_REFERENCE changes after fixing loop initializer.

references.c: fix same bug here.  need to implement parsing.
Still need to implement chasing in cldap.c/result.c
This commit is contained in:
Kurt Zeilenga 1998-12-24 06:00:53 +00:00
parent 090b7ccca0
commit 138d76ecf4
5 changed files with 42 additions and 11 deletions

View file

@ -271,6 +271,7 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
}
if ( result->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
result->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
result->lm_msgtype != LDAP_RES_SEARCH_RESULT &&
result->lm_msgtype != LDAP_RES_COMPARE ) {
/*

View file

@ -472,6 +472,9 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
ber_bvfree( bv );
bv = NULL;
#ifdef notyet
} else if ( tag == LDAP_RES_SEARCH_REFERENCE ) {
#endif
} else {
Debug( LDAP_DEBUG_TRACE, "cldap_parsemsg got unknown tag %lu\n",
tag, 0, 0 );

View file

@ -25,18 +25,34 @@ static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of
LDAPMessage *
ldap_first_entry( LDAP *ld, LDAPMessage *chain )
{
return( chain == NULLMSG || chain->lm_msgtype == LDAP_RES_SEARCH_RESULT
? NULLMSG : chain );
if( ld == NULL || chain == NULLMSG ) {
return NULLMSG;
}
return chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY
? chain
: ldap_next_entry( ld, chain );
}
/* ARGSUSED */
LDAPMessage *ldap_next_entry( LDAP *ld, LDAPMessage *entry )
LDAPMessage *
ldap_next_entry( LDAP *ld, LDAPMessage *entry )
{
if ( entry == NULLMSG || entry->lm_chain == NULLMSG
|| entry->lm_chain->lm_msgtype == LDAP_RES_SEARCH_RESULT )
return( NULLMSG );
if ( ld == NULL || entry == NULLMSG ) {
return NULLMSG;
}
return( entry->lm_chain );
for (
entry = entry->lm_chain;
entry != NULLMSG;
entry = entry->lm_chain )
{
if( entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
return( entry );
}
}
return( NULLMSG );
}
/* ARGSUSED */
@ -45,9 +61,15 @@ ldap_count_entries( LDAP *ld, LDAPMessage *chain )
{
int i;
for ( i = 0; chain != NULL && chain->lm_msgtype
!= LDAP_RES_SEARCH_RESULT; chain = chain->lm_chain )
i++;
if ( ld == NULL ) {
return -1;
}
for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
if( chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
i++;
}
}
return( i );
}

View file

@ -35,7 +35,11 @@ ldap_next_reference( LDAP *ld, LDAPMessage *ref )
return NULLMSG;
}
for ( ; ref != NULLMSG; ref = ref->lm_chain ) {
for (
ref = ref->lm_chain;
ref != NULLMSG;
ref = ref->lm_chain )
{
if( ref->lm_msgtype == LDAP_RES_SEARCH_REFERENCE ) {
return( ref );
}

View file

@ -94,6 +94,7 @@ ldap_result( LDAP *ld, int msgid, int all, struct timeval *timeout,
if ( all == 0
|| (lm->lm_msgtype != LDAP_RES_SEARCH_RESULT
&& lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE /* LDAPv3 */
&& lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY) )
break;