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

version 1.36.2.8, 2000/10/17 19:51:58 version 1.36.2.10, 2000/10/30 17:38:21
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.36.2.7 2000/10/03 17:21:46 kurt Exp $ */  /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.36.2.9 2000/10/30 17:09:16 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.  This is only useful for search responses, which can be   * of messages.  In general, this is only useful for search responses,
  * of two message types (zero or more entries, followed by an   * which can be of three message types (zero or more entries, zero or
  * ldap result).  The type of the first message received is returned.   * search references, followed by an ldap result).  An extension to
    * 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 118  ldap_result( Line 120  ldap_result(
 }  }
   
 static LDAPMessage *  static LDAPMessage *
 chkResponseList( LDAP *ld,  chkResponseList(
                      int msgid,          LDAP *ld,
                      int all)          int msgid,
           int all)
 {  {
         LDAPMessage     *lm, *lastlm, *nextlm;          LDAPMessage     *lm, *lastlm, *nextlm;
     /*      /*
Line 130  chkResponseList( LDAP *ld, Line 133  chkResponseList( LDAP *ld,
          * wait until it arrives or timeout occurs.           * wait until it arrives or timeout occurs.
          */           */
   
         Debug( LDAP_DEBUG_TRACE, "chkResponseList for msgid %d, all %d\n",          Debug( LDAP_DEBUG_TRACE,
                   "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, "chkResponseList msg abandoned, msgid %d\n",                          Debug( LDAP_DEBUG_TRACE,
                                   "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 156  chkResponseList( LDAP *ld, Line 161  chkResponseList( LDAP *ld,
                 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                          if ( all == LDAP_MSG_ONE || msgid == LDAP_RES_UNSOLICITED ) {
                             || (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 ( tmp->lm_msgtype == LDAP_RES_SEARCH_RESULT )                                  if ( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY
                                       && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE
                                           && lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL )
                                   {
                                         break;                                          break;
                                   }
                         }                          }
   
                         if ( tmp == NULL ) {                          if ( tmp == NULL ) {
Line 176  chkResponseList( LDAP *ld, Line 182  chkResponseList( LDAP *ld,
                 }                  }
                 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 185  chkResponseList( LDAP *ld, Line 192  chkResponseList( LDAP *ld,
                     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 195  chkResponseList( LDAP *ld, Line 201  chkResponseList( LDAP *ld,
   
 #ifdef LDAP_DEBUG  #ifdef LDAP_DEBUG
         if( lm == NULL) {          if( lm == NULL) {
                 Debug( LDAP_DEBUG_TRACE, "chkResponseList returns NULL\n", 0, 0, 0);                  Debug( LDAP_DEBUG_TRACE,
                           "ldap_chkResponseList returns NULL\n", 0, 0, 0);
         } else {          } else {
                 Debug( LDAP_DEBUG_TRACE, "chkResponseList returns msgid %d, type %lu\n",                  Debug( LDAP_DEBUG_TRACE,
                             lm->lm_msgid, (unsigned long) lm->lm_msgtype, 0);                          "ldap_chkResponseList returns msgid %d, type 0x%02lu\n",
                           lm->lm_msgid, (unsigned long) lm->lm_msgtype, 0);
         }          }
 #endif  #endif
     return lm;      return lm;

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


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