Diff for /servers/slapd/back-ldap/chain.c between versions 1.19 and 1.20

version 1.19, 2005/01/27 05:45:21 version 1.20, 2005/01/28 00:43:49
Line 1 Line 1
 /* chain.c - chain LDAP operations */  /* chain.c - chain LDAP operations */
 /* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/chain.c,v 1.18 2005/01/26 09:27:38 ando Exp $ */  /* $OpenLDAP: pkg/ldap/servers/slapd/back-ldap/chain.c,v 1.19 2005/01/27 05:45:21 kurt Exp $ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.  /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *   *
  * Copyright 2003-2005 The OpenLDAP Foundation.   * Copyright 2003-2005 The OpenLDAP Foundation.
Line 52 Line 52
 #define get_continuationBehavior(op)    ((op)->o_chaining & SLAP_CH_CONTINUATION_MASK)  #define get_continuationBehavior(op)    ((op)->o_chaining & SLAP_CH_CONTINUATION_MASK)
 #endif /*  LDAP_CONTROL_X_CHAINING_BEHAVIOR */  #endif /*  LDAP_CONTROL_X_CHAINING_BEHAVIOR */
   
   #define LDAP_CH_NONE                    ((void *)(0))
   #define LDAP_CH_RES                     ((void *)(1))
   #define LDAP_CH_ERR                     ((void *)(2))
   
 static int              sc_chainingBehavior;  static int              sc_chainingBehavior;
 static BackendInfo      *lback;  static BackendInfo      *lback;
   
Line 82  ldap_chain_cb_search_response( Operation Line 86  ldap_chain_cb_search_response( Operation
 {  {
         assert( op->o_tag == LDAP_REQ_SEARCH );          assert( op->o_tag == LDAP_REQ_SEARCH );
   
           /* if in error, don't proceed any further */
           if ( op->o_callback->sc_private == LDAP_CH_ERR ) {
                   return 0;
           }
   
         if ( rs->sr_type == REP_SEARCH ) {          if ( rs->sr_type == REP_SEARCH ) {
                 Attribute       **ap = &rs->sr_entry->e_attrs;                  Attribute       **ap = &rs->sr_entry->e_attrs;
   
Line 103  ldap_chain_cb_search_response( Operation Line 112  ldap_chain_cb_search_response( Operation
                                   
                 return SLAP_CB_CONTINUE;                  return SLAP_CB_CONTINUE;
   
           } else if ( rs->sr_type == REP_SEARCHREF ) {
                   /* if we get it here, it means the library was unable
                    * to chase the referral... */
   
   #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
                   if ( get_chaining( op ) > SLAP_CONTROL_IGNORED ) {
                           switch ( get_continuationBehavior( op ) ) {
                           case SLAP_CH_RESOLVE_CHAINING_REQUIRED:
                                   op->o_callback->sc_private = LDAP_CH_ERR;
                                   return -1;
   
                           default:
                                   break;
                           }
                   }
   #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
                   return SLAP_CB_CONTINUE;
   
         } else if ( rs->sr_type == REP_RESULT ) {          } else if ( rs->sr_type == REP_RESULT ) {
                 /* back-ldap tried to send result */                  /* back-ldap tried to send result */
                 op->o_callback->sc_private = (void *)(1);                  op->o_callback->sc_private = LDAP_CH_RES;
         }          }
   
         return 0;          return 0;
Line 118  ldap_chain_cb_search_response( Operation Line 145  ldap_chain_cb_search_response( Operation
 static int  static int
 ldap_chain_cb_response( Operation *op, SlapReply *rs )  ldap_chain_cb_response( Operation *op, SlapReply *rs )
 {  {
           /* if in error, don't proceed any further */
           if ( op->o_callback->sc_private == LDAP_CH_ERR ) {
                   return 0;
           }
   
         if ( rs->sr_type == REP_RESULT ) {          if ( rs->sr_type == REP_RESULT ) {
                 op->o_callback->sc_private = (void *)(1);                  op->o_callback->sc_private = LDAP_CH_RES;
   
         } else if ( op->o_tag == LDAP_REQ_SEARCH && rs->sr_type == REP_SEARCH )          } else if ( op->o_tag == LDAP_REQ_SEARCH && rs->sr_type == REP_SEARCH )
         {          {
Line 430  ldap_chain_response( Operation *op, Slap Line 462  ldap_chain_response( Operation *op, Slap
                                 if ( rc == LDAP_SUCCESS && rs->sr_err == LDAP_SUCCESS ) {                                  if ( rc == LDAP_SUCCESS && rs->sr_err == LDAP_SUCCESS ) {
                                         break;                                          break;
                                 }                                  }
   
                                   rc = rs->sr_err;
                         }                          }
   
                         op->o_req_dn = odn;                          op->o_req_dn = odn;
Line 462  ldap_chain_response( Operation *op, Slap Line 496  ldap_chain_response( Operation *op, Slap
         }          }
   
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR  #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
         if ( rc != LDAP_SUCCESS ) {          if ( rc != LDAP_SUCCESS || sc2.sc_private == LDAP_CH_ERR ) {
                   if ( rs->sr_err == LDAP_CANNOT_CHAIN ) {
                           goto cannot_chain;
                   }
   
                 switch ( ( get_chainingBehavior( op ) & chain_mask ) >> chain_shift ) {                  switch ( ( get_chainingBehavior( op ) & chain_mask ) >> chain_shift ) {
                 case LDAP_CHAINING_REQUIRED:                  case LDAP_CHAINING_REQUIRED:
   cannot_chain:;
                         op->o_callback = NULL;                          op->o_callback = NULL;
                         send_ldap_error( op, rs, LDAP_CANNOT_CHAIN, "operation cannot be completed without chaining" );                          send_ldap_error( op, rs, LDAP_CANNOT_CHAIN, "operation cannot be completed without chaining" );
                         break;                          break;
Line 479  ldap_chain_response( Operation *op, Slap Line 518  ldap_chain_response( Operation *op, Slap
         }          }
 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */  #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
   
         if ( sc2.sc_private == NULL ) {          if ( sc2.sc_private == LDAP_CH_NONE ) {
                 op->o_callback = NULL;                  op->o_callback = NULL;
                 rc = rs->sr_err = slap_map_api2result( rs );                  rc = rs->sr_err = slap_map_api2result( rs );
                 send_ldap_result( op, rs );                  send_ldap_result( op, rs );

Removed from v.1.19  
changed lines
  Added in v.1.20


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