]> git.sur5r.net Git - openldap/commitdiff
allow forcing abandon of search operations on a connection basis
authorPierangelo Masarati <ando@openldap.org>
Tue, 9 Jan 2007 12:19:04 +0000 (12:19 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 9 Jan 2007 12:19:04 +0000 (12:19 +0000)
servers/slapd/back-ldap/back-ldap.h
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/search.c

index 4286424ec43a37734ae1f4bb6ed8912479a4e72e..20be8c8ed57e35b1fd33fb74deecd340d6eb84fb 100644 (file)
@@ -127,8 +127,9 @@ typedef struct ldapconn_t {
 #define        LDAP_BACK_FCONN_ISTLS   (0x00000008U)
 #define        LDAP_BACK_FCONN_BINDING (0x00000010U)
 #define        LDAP_BACK_FCONN_TAINTED (0x00000020U)
-#define        LDAP_BACK_FCONN_ISIDASR (0x00000040U)
-#define        LDAP_BACK_FCONN_CACHED  (0x00000080U)
+#define        LDAP_BACK_FCONN_ABANDON (0x00000040U)
+#define        LDAP_BACK_FCONN_ISIDASR (0x00000080U)
+#define        LDAP_BACK_FCONN_CACHED  (0x00000100U)
 
 #define        LDAP_BACK_CONN_ISBOUND(lc)              LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISBOUND)
 #define        LDAP_BACK_CONN_ISBOUND_SET(lc)          LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISBOUND)
@@ -152,6 +153,9 @@ typedef struct ldapconn_t {
 #define        LDAP_BACK_CONN_TAINTED(lc)              LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_TAINTED)
 #define        LDAP_BACK_CONN_TAINTED_SET(lc)          LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_TAINTED)
 #define        LDAP_BACK_CONN_TAINTED_CLEAR(lc)        LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_TAINTED)
+#define        LDAP_BACK_CONN_ABANDON(lc)              LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ABANDON)
+#define        LDAP_BACK_CONN_ABANDON_SET(lc)          LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ABANDON)
+#define        LDAP_BACK_CONN_ABANDON_CLEAR(lc)        LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ABANDON)
 #define        LDAP_BACK_CONN_ISIDASSERT(lc)           LDAP_BACK_CONN_ISSET((lc), LDAP_BACK_FCONN_ISIDASR)
 #define        LDAP_BACK_CONN_ISIDASSERT_SET(lc)       LDAP_BACK_CONN_SET((lc), LDAP_BACK_FCONN_ISIDASR)
 #define        LDAP_BACK_CONN_ISIDASSERT_CLEAR(lc)     LDAP_BACK_CONN_CLEAR((lc), LDAP_BACK_FCONN_ISIDASR)
@@ -278,7 +282,7 @@ typedef struct ldapinfo_t {
 #define LDAP_BACK_F_USE_TLS            (0x00000002U)
 #define LDAP_BACK_F_PROPAGATE_TLS      (0x00000004U)
 #define LDAP_BACK_F_TLS_CRITICAL       (0x00000008U)
-#define LDAP_BACK_F_TLS_LDAPS  (0x00000010U)
+#define LDAP_BACK_F_TLS_LDAPS          (0x00000010U)
 
 #define LDAP_BACK_F_TLS_USE_MASK       (LDAP_BACK_F_USE_TLS|LDAP_BACK_F_TLS_CRITICAL)
 #define LDAP_BACK_F_TLS_PROPAGATE_MASK (LDAP_BACK_F_PROPAGATE_TLS|LDAP_BACK_F_TLS_CRITICAL)
index be9e5c1df004c40c5d3ef823c2507b0eb1dd117e..75366a79f782bc0a3531a25040a77d790e759221 100644 (file)
@@ -264,7 +264,7 @@ retry:
        for ( rc = 0; rc != -1; rc = ldap_result( lc->lc_ld, msgid, LDAP_MSG_ONE, &tv, &res ) )
        {
                /* check for abandon */
-               if ( op->o_abandon ) {
+               if ( op->o_abandon || LDAP_BACK_CONN_ABANDON( lc ) ) {
                        if ( rc > 0 ) {
                                ldap_msgfree( res );
                        }
index 36a9baf13671b1945dab19da2a2fd7961fef0d68..bb42f21b5fe1fd5ccbd2ea6765dac552575914e7 100644 (file)
@@ -962,7 +962,7 @@ getconn:;
                        }
 
                        /* check for abandon */
-                       if ( op->o_abandon ) {
+                       if ( op->o_abandon || LDAP_BACK_CONN_ABANDON( mc ) ) {
                                break;
                        }
 
@@ -1408,7 +1408,7 @@ free_message:;
                }
 
                /* check for abandon */
-               if ( op->o_abandon || doabandon ) {
+               if ( op->o_abandon || LDAP_BACK_CONN_ABANDON( mc ) ) {
                        for ( i = 0; i < mi->mi_ntargets; i++ ) {
                                if ( candidates[ i ].sr_msgid >= 0 ) {
                                        if ( META_IS_BINDING( &candidates[ i ] ) ) {
@@ -1446,9 +1446,10 @@ free_message:;
 
                        if ( op->o_abandon ) {
                                rc = SLAPD_ABANDON;
-                               /* let send_ldap_result play cleanup handlers (ITS#4645) */
-                               break;
                        }
+
+                       /* let send_ldap_result play cleanup handlers (ITS#4645) */
+                       break;
                }
 
                /* if no entry was found during this loop,
@@ -1465,34 +1466,7 @@ free_message:;
                                lutil_timermul( &save_tv, 2, &save_tv );
                        }
 
-#if 0
-                       if ( LogTest( LDAP_DEBUG_TRACE ) ) {
-                               char    buf[ SLAP_TEXT_BUFLEN ];
-
-                               snprintf( buf, sizeof( buf ), "%s %ld.%06ld %d/%d mc=%p",
-                                       op->o_log_prefix, save_tv.tv_sec, save_tv.tv_usec,
-                                       ncandidates, initial_candidates, mc );
-                               Debug( LDAP_DEBUG_TRACE, "### %s\n", buf, 0, 0 );
-                               for ( i = 0; i < mi->mi_ntargets; i++ ) {
-                                       if ( candidates[ i ].sr_msgid == META_MSGID_IGNORE ) {
-                                               continue;
-                                       }
-                       
-                                       snprintf( buf, sizeof( buf ), "[%ld] ld=%p%s%s\n",
-                                               i,
-                                               mc->mc_conns[ i ].msc_ld,
-                                               ( candidates[ i ].sr_msgid == META_MSGID_NEED_BIND ) ?  " needbind" : "",
-                                               META_IS_BINDING( &candidates[ i ] ) ? " binding" : "" );
-                                       Debug( LDAP_DEBUG_TRACE, "###    %s\n", buf, 0, 0 );
-                               }
-                       }
-#endif
-
                        if ( alreadybound == 0 ) {
-#if 0
-                               Debug( LDAP_DEBUG_TRACE, "### %s select(%ld.%06ld)\n",
-                                       op->o_log_prefix, save_tv.tv_sec, save_tv.tv_usec );
-#endif
                                tv = save_tv;
                                (void)select( 0, NULL, NULL, NULL, &tv );
 
@@ -1582,28 +1556,6 @@ free_message:;
                matched = op->o_bd->be_suffix[ 0 ].bv_val;
        }
 
-#if 0
-       {
-               char    buf[ SLAP_TEXT_BUFLEN ];
-               char    cnd[ SLAP_TEXT_BUFLEN ];
-               int     i;
-
-               for ( i = 0; i < mi->mi_ntargets; i++ ) {
-                       if ( META_IS_CANDIDATE( &candidates[ i ] ) ) {
-                               cnd[ i ] = '*';
-                       } else {
-                               cnd[ i ] = ' ';
-                       }
-               }
-               cnd[ i ] = '\0';
-
-               snprintf( buf, sizeof( buf ), "%s meta_back_search: is_scope=%d is_ok=%d cnd=\"%s\"\n",
-                       op->o_log_prefix, initial_candidates, is_ok, cnd );
-
-               Debug( LDAP_DEBUG_ANY, "%s", buf, 0, 0 );
-       }
-#endif
-
        /*
         * In case we returned at least one entry, we return LDAP_SUCCESS
         * otherwise, the latter error code we got