Diff for /libraries/libldap/result.c between versions 1.36.2.10 and 1.53

version 1.36.2.10, 2000/10/30 17:38:21 version 1.53, 2000/10/11 19:11:34
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.36.2.9 2000/10/30 17:09:16 kurt Exp $ */  /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.52 2000/10/11 02:23:23 kurt Exp $ */
 /*  /*
  * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.   * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
Line 74  static LDAPMessage * chkResponseList LDA Line 74  static LDAPMessage * chkResponseList LDA
  * with msgid.  If all is LDAP_MSG_ONE (0) the first message with id   * with msgid.  If all is LDAP_MSG_ONE (0) the first message with id
  * msgid will be accepted, otherwise, ldap_result will wait for all   * msgid will be accepted, otherwise, ldap_result will wait for all
  * responses with id msgid and then return a pointer to the entire list   * responses with id msgid and then return a pointer to the entire list
  * of messages.  In general, this is only useful for search responses,   * of messages.  This is only useful for search responses, which can be
  * which can be of three message types (zero or more entries, zero or   * of two message types (zero or more entries, followed by an
  * search references, followed by an ldap result).  An extension to   * ldap result).  The type of the first message received is returned.
  * LDAPv3 allows partial extended responses to be returned in response  
  * to any request.  The type of the first message received is returned.  
  * When waiting, any messages that have been abandoned are discarded.   * When waiting, any messages that have been abandoned are discarded.
  *   *
  * Example:   * Example:
Line 120  ldap_result( Line 118  ldap_result(
 }  }
   
 static LDAPMessage *  static LDAPMessage *
 chkResponseList(  chkResponseList( LDAP *ld,
         LDAP *ld,                       int msgid,
         int msgid,                       int all)
         int all)  
 {  {
         LDAPMessage     *lm, *lastlm, *nextlm;          LDAPMessage     *lm, *lastlm, *nextlm;
     /*      /*
Line 133  chkResponseList( Line 130  chkResponseList(
          * wait until it arrives or timeout occurs.           * wait until it arrives or timeout occurs.
          */           */
   
         Debug( LDAP_DEBUG_TRACE,          Debug( LDAP_DEBUG_TRACE, "chkResponseList for msgid %d, all %d\n",
                 "ldap_chkResponseList for msgid=%d, all=%d\n",  
             msgid, all, 0 );              msgid, all, 0 );
         lastlm = NULL;          lastlm = NULL;
         for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) {          for ( lm = ld->ld_responses; lm != NULL; lm = nextlm ) {
                 nextlm = lm->lm_next;                  nextlm = lm->lm_next;
   
                 if ( ldap_abandoned( ld, lm->lm_msgid ) ) {                  if ( ldap_abandoned( ld, lm->lm_msgid ) ) {
                         Debug( LDAP_DEBUG_TRACE,                          Debug( LDAP_DEBUG_TRACE, "chkResponseList msg abandoned, msgid %d\n",
                                 "ldap_chkResponseList msg abandoned, msgid %d\n",  
                             msgid, 0, 0 );                              msgid, 0, 0 );
                         ldap_mark_abandoned( ld, lm->lm_msgid );                          ldap_mark_abandoned( ld, lm->lm_msgid );
   
Line 161  chkResponseList( Line 156  chkResponseList(
                 if ( msgid == LDAP_RES_ANY || lm->lm_msgid == msgid ) {                  if ( msgid == LDAP_RES_ANY || lm->lm_msgid == msgid ) {
                         LDAPMessage     *tmp;                          LDAPMessage     *tmp;
   
                         if ( all == LDAP_MSG_ONE || msgid == LDAP_RES_UNSOLICITED ) {                          if ( all == LDAP_MSG_ONE
                               || (lm->lm_msgtype != LDAP_RES_SEARCH_RESULT
                               && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE      /* LDAPv3 */
                               && lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY
                                   && lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL) )
                                 break;                                  break;
                         }  
   
                         for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) {                          for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) {
                                 if ( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY                                  if ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT )
                                     && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE  
                                         && lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL )  
                                 {  
                                         break;                                          break;
                                 }  
                         }                          }
   
                         if ( tmp == NULL ) {                          if ( tmp == NULL ) {
Line 182  chkResponseList( Line 176  chkResponseList(
                 }                  }
                 lastlm = lm;                  lastlm = lm;
         }          }
   
     if ( lm != NULL ) {      if ( lm != NULL ) {
                 /* Found an entry, remove it from the list */                  /* Found an entry, remove it from the list */
             if ( lastlm == NULL ) {              if ( lastlm == NULL ) {
Line 192  chkResponseList( Line 185  chkResponseList(
                     lastlm->lm_next = (all == LDAP_MSG_ONE && lm->lm_chain != NULL                      lastlm->lm_next = (all == LDAP_MSG_ONE && lm->lm_chain != NULL
                         ? lm->lm_chain : lm->lm_next);                          ? lm->lm_chain : lm->lm_next);
             }              }
             if ( all == LDAP_MSG_ONE && lm->lm_chain != NULL ) {              if ( all == LDAP_MSG_ONE && lm->lm_chain != NULL )
               {
                     lm->lm_chain->lm_next = lm->lm_next;                      lm->lm_chain->lm_next = lm->lm_next;
                     lm->lm_chain = NULL;                      lm->lm_chain = NULL;
             }              }
Line 201  chkResponseList( Line 195  chkResponseList(
   
 #ifdef LDAP_DEBUG  #ifdef LDAP_DEBUG
         if( lm == NULL) {          if( lm == NULL) {
                 Debug( LDAP_DEBUG_TRACE,                  Debug( LDAP_DEBUG_TRACE, "chkResponseList returns NULL\n", 0, 0, 0);
                         "ldap_chkResponseList returns NULL\n", 0, 0, 0);  
         } else {          } else {
                 Debug( LDAP_DEBUG_TRACE,                  Debug( LDAP_DEBUG_TRACE, "chkResponseList returns msgid %d, type %lu\n",
                         "ldap_chkResponseList returns msgid %d, type 0x%02lu\n",                              lm->lm_msgid, (unsigned long) lm->lm_msgtype, 0);
                         lm->lm_msgid, (unsigned long) lm->lm_msgtype, 0);  
         }          }
 #endif  #endif
     return lm;      return lm;

Removed from v.1.36.2.10  
changed lines
  Added in v.1.53


______________
© Copyright 1998-2020, OpenLDAP Foundation, info@OpenLDAP.org