- if ( lm->lm_chain == NULL ) {
- assert(lm->lm_chain_tail == lm);
- if ((lm->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
- (lm->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
- (lm->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
- tmp = NULL;
- } else {
- tmp = lm;
- }
- } else {
- assert(lm->lm_chain_tail);
- assert(lm->lm_chain_tail->lm_chain);
- if ((lm->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_SEARCH_ENTRY) ||
- (lm->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_SEARCH_REFERENCE) ||
- (lm->lm_chain_tail->lm_chain->lm_msgtype
- == LDAP_RES_INTERMEDIATE)) {
- tmp = NULL;
- } else {
- tmp = lm->lm_chain_tail->lm_chain;
- }
+ tmp = lm->lm_chain_tail;
+ if ((tmp->lm_msgtype == LDAP_RES_SEARCH_ENTRY) ||
+ (tmp->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) ||
+ (tmp->lm_msgtype == LDAP_RES_INTERMEDIATE)) {
+ tmp = NULL;