]> git.sur5r.net Git - openldap/commitdiff
ITS#6759
authorQuanah Gibson-Mount <quanah@openldap.org>
Thu, 6 Jan 2011 19:47:32 +0000 (19:47 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Thu, 6 Jan 2011 19:47:32 +0000 (19:47 +0000)
CHANGES
libraries/librewrite/context.c
servers/slapd/back-bdb/tools.c
servers/slapd/back-ldap/extended.c
servers/slapd/connection.c
servers/slapd/result.c

diff --git a/CHANGES b/CHANGES
index 7c25ecd22a17c6a24bcf6fb3a9919b0e8b1412d6..b5f22e132d60c37c5d76369f0cf0b66fb2b4b8fb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -38,6 +38,7 @@ OpenLDAP 2.4.24 Engineering
        Fixed ldapsearch multiple controls parsing (ITS#6651)
        Fixed slapd acl parsing overflow (ITS#6611)
        Fixed slapd assert control (ITS#5862)
+       Fixed slapd assertions and debugging (ITS#6759)
        Fixed slapd support for BDB 5.0+ (ITS#6698)
        Fixed slapd config leak with olcDbDirectory (ITS#6634)
        Fixed slapd connectionless warnings (ITS#6747)
index 67704eb3e48a8f20049101b2be60508d58a4526f..9348df8e161bca896c7ffb8b9c4e8500ded2fcde 100644 (file)
@@ -215,11 +215,11 @@ rewrite_context_apply(
        assert( result != NULL );
 
        op->lo_depth++;
-       assert( op->lo_depth > 0 );
 
        Debug( LDAP_DEBUG_TRACE, "==> rewrite_context_apply"
                        " [depth=%d] string='%s'\n",
                        op->lo_depth, string, 0 );
+       assert( op->lo_depth > 0 );
        
        s = (char *)string;
        
index a8f13ce1d49fa13e477758b2a52d2e2807571902..f5d104567b19f78fa7b70ca0fca7189f51fd0757 100644 (file)
@@ -718,12 +718,11 @@ int bdb_tool_entry_reindex(
        Operation op = {0};
        Opheader ohdr = {0};
 
-       assert( tool_base == NULL );
-       assert( tool_filter == NULL );
-
        Debug( LDAP_DEBUG_ARGS,
                "=> " LDAP_XSTRING(bdb_tool_entry_reindex) "( %ld )\n",
                (long) id, 0, 0 );
+       assert( tool_base == NULL );
+       assert( tool_filter == NULL );
 
        /* No indexes configured, nothing to do. Could return an
         * error here to shortcut things.
index 13308a6a9cf20e618d2f1684eb264470d460a72c..e1402c3bb1fe51134781dbc0a2ca82fde7a5d413 100644 (file)
@@ -305,11 +305,10 @@ ldap_back_exop_generic(
        int             do_retry = 1;
        char            *text = NULL;
 
-       assert( lc != NULL );
-       assert( rs->sr_ctrls == NULL );
-
        Debug( LDAP_DEBUG_ARGS, "==> ldap_back_exop_generic(%s, \"%s\")\n",
                op->ore_reqoid.bv_val, op->o_req_dn.bv_val, 0 );
+       assert( lc != NULL );
+       assert( rs->sr_ctrls == NULL );
 
 retry:
        rc = ldap_extended_operation( lc->lc_ld,
index a7aff7a40e77ce9a6cee73bcd98878cf7721b6db..79d99003af4b977dc796aa23a55ffc159aff45cc 100644 (file)
@@ -276,12 +276,11 @@ static Connection* connection_get( ber_socket_t s )
                if( c->c_struct_state != SLAP_C_USED ) {
                        /* connection must have been closed due to resched */
 
-                       assert( c->c_conn_state == SLAP_C_INVALID );
-                       assert( c->c_sd == AC_SOCKET_INVALID );
-
                        Debug( LDAP_DEBUG_CONNS,
                                "connection_get(%d): connection not used\n",
                                s, 0, 0 );
+                       assert( c->c_conn_state == SLAP_C_INVALID );
+                       assert( c->c_sd == AC_SOCKET_INVALID );
 
                        ldap_pvt_thread_mutex_unlock( &c->c_mutex );
                        return NULL;
index 13a04cd89b82391fcea8e3816d8036a0acdbe74e..421fdbc1af41deea2f958b8c54e6292d2b534957 100644 (file)
@@ -657,15 +657,14 @@ send_ldap_disconnect( Operation   *op, SlapReply *rs )
        || (e) == LDAP_STRONG_AUTH_REQUIRED \
        || (e) == LDAP_UNAVAILABLE )
 
+       Debug( LDAP_DEBUG_TRACE,
+               "send_ldap_disconnect %d:%s\n",
+               rs->sr_err, rs->sr_text ? rs->sr_text : "", NULL );
        assert( LDAP_UNSOLICITED_ERROR( rs->sr_err ) );
 
        rs->sr_type = REP_EXTENDED;
        rs->sr_rspdata = NULL;
 
-       Debug( LDAP_DEBUG_TRACE,
-               "send_ldap_disconnect %d:%s\n",
-               rs->sr_err, rs->sr_text ? rs->sr_text : "", NULL );
-
        if ( op->o_protocol < LDAP_VERSION3 ) {
                rs->sr_rspoid = NULL;
                rs->sr_tag = slap_req2res( op->o_tag );
@@ -698,25 +697,20 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
        if ( rs->sr_err == SLAPD_ABANDON || op->o_abandon )
                goto abandon;
 
-       assert( !LDAP_API_ERROR( rs->sr_err ) );
-
        Debug( LDAP_DEBUG_TRACE,
                "send_ldap_result: %s p=%d\n",
                op->o_log_prefix, op->o_protocol, 0 );
-
        Debug( LDAP_DEBUG_ARGS,
                "send_ldap_result: err=%d matched=\"%s\" text=\"%s\"\n",
                rs->sr_err, rs->sr_matched ? rs->sr_matched : "",
                rs->sr_text ? rs->sr_text : "" );
-
-
        if( rs->sr_ref ) {
                Debug( LDAP_DEBUG_ARGS,
                        "send_ldap_result: referral=\"%s\"\n",
                        rs->sr_ref[0].bv_val ? rs->sr_ref[0].bv_val : "NULL",
                        NULL, NULL );
        }
-
+       assert( !LDAP_API_ERROR( rs->sr_err ) );
        assert( rs->sr_err != LDAP_PARTIAL_RESULTS );
 
        if ( rs->sr_err == LDAP_REFERRAL ) {
@@ -769,11 +763,11 @@ abandon:
 void
 send_ldap_sasl( Operation *op, SlapReply *rs )
 {
-       rs->sr_type = REP_SASL;
        Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl: err=%d len=%ld\n",
                rs->sr_err,
                rs->sr_sasldata ? (long) rs->sr_sasldata->bv_len : -1, NULL );
 
+       rs->sr_type = REP_SASL;
        rs->sr_tag = slap_req2res( op->o_tag );
        rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
 
@@ -788,14 +782,13 @@ send_ldap_sasl( Operation *op, SlapReply *rs )
 void
 slap_send_ldap_extended( Operation *op, SlapReply *rs )
 {
-       rs->sr_type = REP_EXTENDED;
-
        Debug( LDAP_DEBUG_TRACE,
                "send_ldap_extended: err=%d oid=%s len=%ld\n",
                rs->sr_err,
                rs->sr_rspoid ? rs->sr_rspoid : "",
                rs->sr_rspdata != NULL ? rs->sr_rspdata->bv_len : 0 );
 
+       rs->sr_type = REP_EXTENDED;
        rs->sr_tag = slap_req2res( op->o_tag );
        rs->sr_msgid = (rs->sr_tag != LBER_SEQUENCE) ? op->o_msgid : 0;
 
@@ -810,12 +803,13 @@ slap_send_ldap_extended( Operation *op, SlapReply *rs )
 void
 slap_send_ldap_intermediate( Operation *op, SlapReply *rs )
 {
-       rs->sr_type = REP_INTERMEDIATE;
        Debug( LDAP_DEBUG_TRACE,
                "send_ldap_intermediate: err=%d oid=%s len=%ld\n",
                rs->sr_err,
                rs->sr_rspoid ? rs->sr_rspoid : "",
                rs->sr_rspdata != NULL ? rs->sr_rspdata->bv_len : 0 );
+
+       rs->sr_type = REP_INTERMEDIATE;
        rs->sr_tag = LDAP_RES_INTERMEDIATE;
        rs->sr_msgid = op->o_msgid;
        if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {