Diff for /libraries/libldap/result.c between versions 1.84.2.2 and 1.94

version 1.84.2.2, 2003/09/18 15:43:32 version 1.94, 2004/07/24 01:13:29
Line 1 Line 1
 /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.84.2.1 2003/05/31 19:01:39 kurt Exp $ */  /* result.c - wait for an ldap result */
 /*  /* $OpenLDAP: pkg/ldap/libraries/libldap/result.c,v 1.93 2004/03/25 11:15:52 hyc Exp $ */
  * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file   *
    * Copyright 1998-2004 The OpenLDAP Foundation.
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted only as authorized by the OpenLDAP
    * Public License.
    *
    * A copy of this license is available in the file LICENSE in the
    * top-level directory of the distribution or, alternatively, at
    * <http://www.OpenLDAP.org/license.html>.
  */   */
 /*  Portions  /* Portions Copyright (c) 1990 Regents of the University of Michigan.
  *  Copyright (c) 1990 Regents of the University of Michigan.   * All rights reserved.
  *  All rights reserved.  
  */   */
 /*---  /* This notice applies to changes, created by or for Novell, Inc.,
  * This notice applies to changes, created by or for Novell, Inc.,  
  * to preexisting works for which notices appear elsewhere in this file.   * to preexisting works for which notices appear elsewhere in this file.
  *   *
  * Copyright (C) 1999, 2000 Novell, Inc. All Rights Reserved.   * Copyright (C) 1999, 2000 Novell, Inc. All Rights Reserved.
Line 24 Line 32
  *---   *---
  * Modification to OpenLDAP source by Novell, Inc.   * Modification to OpenLDAP source by Novell, Inc.
  * April 2000 sfs Add code to process V3 referrals and search results   * April 2000 sfs Add code to process V3 referrals and search results
  *   *---
  *  result.c - wait for an ldap result   * Note: A verbatim copy of version 2.0.1 of the OpenLDAP Public License 
  */  
 /* Note: A verbatim copy of version 2.0.1 of the OpenLDAP Public License   
  * can be found in the file "build/LICENSE-2.0.1" in this distribution   * can be found in the file "build/LICENSE-2.0.1" in this distribution
  * of OpenLDAP Software.   * of OpenLDAP Software.
  */   */
 /*  /* Portions Copyright (C) The Internet Society (1997)
  * Portions Copyright (C) The Internet Society (1997)  
  * ASN.1 fragments are from RFC 2251; see RFC for full legal notices.   * ASN.1 fragments are from RFC 2251; see RFC for full legal notices.
  */   */
   
Line 68  static int ldap_mark_abandoned LDAP_P(( Line 73  static int ldap_mark_abandoned LDAP_P((
 static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout,  static int wait4msg LDAP_P(( LDAP *ld, ber_int_t msgid, int all, struct timeval *timeout,
         LDAPMessage **result ));          LDAPMessage **result ));
 static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid,  static ber_tag_t try_read1msg LDAP_P(( LDAP *ld, ber_int_t msgid,
         int all, Sockbuf *sb, LDAPConn *lc, LDAPMessage **result ));          int all, Sockbuf *sb, LDAPConn **lc, LDAPMessage **result ));
 static ber_tag_t build_result_ber LDAP_P(( LDAP *ld, BerElement **bp, LDAPRequest *lr ));  static ber_tag_t build_result_ber LDAP_P(( LDAP *ld, BerElement **bp, LDAPRequest *lr ));
 static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));  static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
 static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all));  static LDAPMessage * chkResponseList LDAP_P(( LDAP *ld, int msgid, int all));
Line 309  wait4msg( Line 314  wait4msg(
         if( (*result = chkResponseList(ld, msgid, all)) != NULL ) {          if( (*result = chkResponseList(ld, msgid, all)) != NULL ) {
             rc = (*result)->lm_msgtype;              rc = (*result)->lm_msgtype;
         } else {          } else {
                           int lc_ready = 0;
   
                         for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {                          for ( lc = ld->ld_conns; lc != NULL; lc = nextlc ) {
                                   nextlc = lc->lconn_next;
                                 if ( ber_sockbuf_ctrl( lc->lconn_sb,                                  if ( ber_sockbuf_ctrl( lc->lconn_sb,
                                                 LBER_SB_OPT_DATA_READY, NULL ) ) {                                                  LBER_SB_OPT_DATA_READY, NULL ) ) {
                                             rc = try_read1msg( ld, msgid, all, lc->lconn_sb,                                          rc = try_read1msg( ld, msgid, all, lc->lconn_sb,
                                                 lc, result );                                                  &lc, result );
                                           lc_ready = 1;
                                     break;                                      break;
                                 }                                  }
                 }                  }
   
                     if ( lc == NULL ) {                      if ( !lc_ready ) {
                             rc = ldap_int_select( ld, tvp );                              rc = ldap_int_select( ld, tvp );
 #ifdef LDAP_DEBUG  #ifdef LDAP_DEBUG
                             if ( rc == -1 ) {                              if ( rc == -1 ) {
Line 368  wait4msg( Line 376  wait4msg(
                                                 ldap_is_read_ready( ld,                                                  ldap_is_read_ready( ld,
                                                 lc->lconn_sb )) {                                                  lc->lconn_sb )) {
                                                     rc = try_read1msg( ld, msgid, all,                                                      rc = try_read1msg( ld, msgid, all,
                                                         lc->lconn_sb, lc, result );                                                          lc->lconn_sb, &lc, result );
                                                           if ( lc == NULL ) lc = nextlc;
                                             }                                              }
                                     }                                      }
                             }                              }
Line 404  try_read1msg( Line 413  try_read1msg(
         ber_int_t msgid,          ber_int_t msgid,
         int all,          int all,
         Sockbuf *sb,          Sockbuf *sb,
         LDAPConn *lc,          LDAPConn **lcp,
         LDAPMessage **result )          LDAPMessage **result )
 {  {
         BerElement      *ber;          BerElement      *ber;
Line 414  try_read1msg( Line 423  try_read1msg(
         ber_len_t       len;          ber_len_t       len;
         int             foundit = 0;          int             foundit = 0;
         LDAPRequest     *lr, *tmplr;          LDAPRequest     *lr, *tmplr;
           LDAPConn        *lc;
         BerElement      tmpber;          BerElement      tmpber;
         int             rc, refer_cnt, hadref, simple_request;          int             rc, refer_cnt, hadref, simple_request;
         ber_int_t       lderr;          ber_int_t       lderr;
Line 427  try_read1msg( Line 437  try_read1msg(
         int     v3ref;          int     v3ref;
   
         assert( ld != NULL );          assert( ld != NULL );
         assert( lc != NULL );          assert( lcp != NULL );
           assert( *lcp != NULL );
                   
 #ifdef NEW_LOGGING  #ifdef NEW_LOGGING
         LDAP_LOG ( OPERATION, ARGS, "read1msg: msgid %d, all %d\n", msgid, all, 0 );          LDAP_LOG ( OPERATION, ARGS, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
Line 435  try_read1msg( Line 446  try_read1msg(
         Debug( LDAP_DEBUG_TRACE, "read1msg: msgid %d, all %d\n", msgid, all, 0 );          Debug( LDAP_DEBUG_TRACE, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
 #endif  #endif
   
           lc = *lcp;
   
 retry:  retry:
         if ( lc->lconn_ber == NULL ) {          if ( lc->lconn_ber == NULL ) {
                 lc->lconn_ber = ldap_alloc_ber_with_options(ld);                  lc->lconn_ber = ldap_alloc_ber_with_options(ld);
Line 810  lr->lr_res_matched ? lr->lr_res_matched Line 823  lr->lr_res_matched ? lr->lr_res_matched
   
                         if ( lc != NULL ) {                          if ( lc != NULL ) {
                                 ldap_free_connection( ld, lc, 0, 1 );                                  ldap_free_connection( ld, lc, 0, 1 );
                                   *lcp = NULL;
                         }                          }
                 }                  }
         }          }

Removed from v.1.84.2.2  
changed lines
  Added in v.1.94


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