]> git.sur5r.net Git - openldap/commitdiff
preformat "conn=%lu op=%lu"
authorPierangelo Masarati <ando@openldap.org>
Sun, 26 Sep 2004 23:00:00 +0000 (23:00 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 26 Sep 2004 23:00:00 +0000 (23:00 +0000)
17 files changed:
servers/slapd/add.c
servers/slapd/back-dnssrv/bind.c
servers/slapd/back-dnssrv/referral.c
servers/slapd/back-dnssrv/search.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/connection.c
servers/slapd/controls.c
servers/slapd/delete.c
servers/slapd/limits.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/result.c
servers/slapd/search.c
servers/slapd/slap.h
servers/slapd/starttls.c
servers/slapd/unbind.c

index 1c3a5f276633720013b86c669426f578a65cf498..a1e99928704aeae848f2a9a38d3b6121816fad39 100644 (file)
@@ -146,8 +146,8 @@ do_add( Operation *op, SlapReply *rs )
                goto done;
        }
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu ADD dn=\"%s\"\n",
-           op->o_connid, op->o_opid, e->e_name.bv_val, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s ADD dn=\"%s\"\n",
+           op->o_log_prefix, e->e_name.bv_val, 0, 0, 0 );
 
        if( e->e_nname.bv_len == 0 ) {
                /* protocolError may be a more appropriate error */
index 529ced8a87a2d35e0314f7e2577a373bf81630d4..a5a3fe3d9b3fb006cd670a1bcf049664e8c50551 100644 (file)
@@ -43,9 +43,9 @@ dnssrv_back_bind(
                op->oq_bind.rb_cred.bv_val != NULL && op->oq_bind.rb_cred.bv_len )
        {
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu DNSSRV BIND dn=\"%s\" provided passwd\n",
-                        op->o_connid, op->o_opid,
-                       op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val , 0, 0 );
+                       "%s DNSSRV BIND dn=\"%s\" provided passwd\n",
+                       op->o_log_prefix,
+                       op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val , 0, 0, 0 );
 
                Debug( LDAP_DEBUG_TRACE,
                        "DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
index 05c19c6b606bf8092ad22e83afd3a5b35ea06587..1d5ba88edb9df55153619465eaba25c91316c25a 100644 (file)
@@ -99,9 +99,9 @@ dnssrv_back_referrals(
        }
 
        Statslog( LDAP_DEBUG_STATS,
-           "conn=%lu op=%lu DNSSRV p=%d dn=\"%s\" url=\"%s\"\n",
-           op->o_connid, op->o_opid, op->o_protocol,
-               op->o_req_dn.bv_val, urls[0].bv_val );
+           "%s DNSSRV p=%d dn=\"%s\" url=\"%s\"\n",
+           op->o_log_prefix, op->o_protocol,
+               op->o_req_dn.bv_val, urls[0].bv_val, 0 );
 
        Debug( LDAP_DEBUG_TRACE, "DNSSRV: dn=\"%s\" -> url=\"%s\"\n",
                op->o_req_dn.bv_val, urls[0].bv_val, 0 );
index cac168ad1aec1e2bba202f84e4fb2b901d9c76f9..40c03230f0bcb9b181dbd4b7b910a6a4f31d1dc9 100644 (file)
@@ -103,9 +103,9 @@ dnssrv_back_search(
        }
 
        Statslog( LDAP_DEBUG_STATS,
-           "conn=%lu op=%lu DNSSRV p=%d dn=\"%s\" url=\"%s\"\n",
-           op->o_connid, op->o_opid, op->o_protocol,
-               op->o_req_dn.bv_len ? op->o_req_dn.bv_val : "", urls[0].bv_val );
+           "%s DNSSRV p=%d dn=\"%s\" url=\"%s\"\n",
+           op->o_log_prefix, op->o_protocol,
+               op->o_req_dn.bv_len ? op->o_req_dn.bv_val : "", urls[0].bv_val, 0 );
 
        Debug( LDAP_DEBUG_TRACE,
                "DNSSRV: ManageDSAit scope=%d dn=\"%s\" -> url=\"%s\"\n",
index 55c9e8bb471acdfcc34e9a090102ee36a8c03be3..836e9d4ce51056a8e5101bc5244769160b59df8a 100644 (file)
@@ -59,25 +59,26 @@ do_bind(
        if ( op->o_conn->c_sasl_bind_in_progress ) {
                be = op->o_conn->c_authz_backend;
        }
-       if ( op->o_conn->c_dn.bv_len ) {
+       if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
                /* log authorization identity demotion */
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu BIND anonymous mech=implicit ssf=0\n",
-                       op->o_connid, op->o_opid, 0, 0, 0 );
+                       "%s BIND anonymous mech=implicit ssf=0\n",
+                       op->o_log_prefix, 0, 0, 0, 0 );
        }
        connection2anonymous( op->o_conn );
        if ( op->o_conn->c_sasl_bind_in_progress ) {
                op->o_conn->c_authz_backend = be;
        }
        ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
-       if ( op->o_dn.bv_val != NULL ) {
-               free( op->o_dn.bv_val );
-               op->o_dn.bv_val = ch_strdup( "" );
+       if ( !BER_BVISNULL( &op->o_dn ) ) {
+               /* NOTE: temporarily wasting few bytes
+                * (until bind is completed), but saving
+                * a couple of ch_free() and ch_strdup("") */ 
+               op->o_dn.bv_val[0] = '\0';
                op->o_dn.bv_len = 0;
        }
-       if ( op->o_ndn.bv_val != NULL ) {
-               free( op->o_ndn.bv_val );
-               op->o_ndn.bv_val = ch_strdup( "" );
+       if ( !BER_BVISNULL( &op->o_ndn ) ) {
+               op->o_ndn.bv_val[0] = '\0';
                op->o_ndn.bv_len = 0;
        }
 
@@ -171,9 +172,9 @@ do_bind(
                        (unsigned long) op->orb_method );
        }
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu BIND dn=\"%s\" method=%ld\n",
-           op->o_connid, op->o_opid, op->o_req_dn.bv_val,
-               (unsigned long) op->orb_method, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s BIND dn=\"%s\" method=%ld\n",
+           op->o_log_prefix, op->o_req_dn.bv_val,
+               (unsigned long) op->orb_method, 0, 0 );
 
        if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
                Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
@@ -212,11 +213,11 @@ cleanup:
 
        op->o_conn->c_sasl_bindop = NULL;
 
-       if( op->o_req_dn.bv_val != NULL ) {
+       if( !BER_BVISNULL( &op->o_req_dn ) ) {
                slap_sl_free( op->o_req_dn.bv_val, op->o_tmpmemctx );
                BER_BVZERO( &op->o_req_dn );
        }
-       if( op->o_req_ndn.bv_val != NULL ) {
+       if( !BER_BVISNULL( &op->o_req_ndn ) ) {
                slap_sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
                BER_BVZERO( &op->o_req_ndn );
        }
@@ -250,7 +251,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        goto cleanup;
                }
 
-               if( mech.bv_len == 0 ) {
+               if( BER_BVISNULL( &mech ) || BER_BVISEMPTY( &mech ) ) {
                        Debug( LDAP_DEBUG_ANY,
                                "do_bind: no sasl mechanism provided\n",
                                0, 0, 0 );
@@ -281,7 +282,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
                if( rs->sr_err == LDAP_SUCCESS ) {
                        ber_dupbv(&op->o_conn->c_dn, &op->orb_edn);
-                       if( op->orb_edn.bv_len != 0 ) {
+                       if( !BER_BVISEMPTY( &op->orb_edn ) ) {
                                /* edn is always normalized already */
                                ber_dupbv( &op->o_conn->c_ndn, &op->o_conn->c_dn );
                        }
@@ -296,7 +297,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                                op->o_conn->c_ssf = op->orb_ssf;
                        }
 
-                       if( op->o_conn->c_dn.bv_len != 0 ) {
+                       if( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
                                ber_len_t max = sockbuf_max_incoming_auth;
                                ber_sockbuf_ctrl( op->o_conn->c_sb,
                                        LBER_SB_OPT_SET_MAX_INCOMING, &max );
@@ -304,22 +305,22 @@ fe_op_bind( Operation *op, SlapReply *rs )
 
                        /* log authorization identity */
                        Statslog( LDAP_DEBUG_STATS,
-                               "conn=%lu op=%lu BIND dn=\"%s\" mech=%s ssf=%d\n",
-                               op->o_connid, op->o_opid,
-                               op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
-                               op->o_conn->c_authmech.bv_val, op->orb_ssf );
+                               "%s BIND dn=\"%s\" mech=%s ssf=%d\n",
+                               op->o_log_prefix,
+                               BER_BVISNULL( &op->o_conn->c_dn ) ? "<empty>" : op->o_conn->c_dn.bv_val,
+                               op->o_conn->c_authmech.bv_val, op->orb_ssf, 0 );
 
                        Debug( LDAP_DEBUG_TRACE,
                                "do_bind: SASL/%s bind: dn=\"%s\" ssf=%d\n",
                                op->o_conn->c_authmech.bv_val,
-                               op->o_conn->c_dn.bv_val ? op->o_conn->c_dn.bv_val : "<empty>",
+                               BER_BVISNULL( &op->o_conn->c_dn ) ? "<empty>" : op->o_conn->c_dn.bv_val,
                                op->orb_ssf );
 
                } else if ( rs->sr_err == LDAP_SASL_BIND_IN_PROGRESS ) {
                        op->o_conn->c_sasl_bind_in_progress = 1;
 
                } else {
-                       if ( op->o_conn->c_sasl_bind_mech.bv_val ) {
+                       if ( !BER_BVISNULL( &op->o_conn->c_sasl_bind_mech ) ) {
                                free( op->o_conn->c_sasl_bind_mech.bv_val );
                                BER_BVZERO( &op->o_conn->c_sasl_bind_mech );
                        }
@@ -355,8 +356,8 @@ fe_op_bind( Operation *op, SlapReply *rs )
                /* Not SASL, cancel any in-progress bind */
                ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
 
-               if ( op->o_conn->c_sasl_bind_mech.bv_val != NULL ) {
-                       free(op->o_conn->c_sasl_bind_mech.bv_val);
+               if ( !BER_BVISNULL( &op->o_conn->c_sasl_bind_mech ) ) {
+                       free( op->o_conn->c_sasl_bind_mech.bv_val );
                        BER_BVZERO( &op->o_conn->c_sasl_bind_mech );
                }
                op->o_conn->c_sasl_bind_in_progress = 0;
@@ -366,18 +367,18 @@ fe_op_bind( Operation *op, SlapReply *rs )
        }
 
        if ( op->orb_method == LDAP_AUTH_SIMPLE ) {
-               ber_str2bv( "SIMPLE", sizeof("SIMPLE")-1, 0, &mech );
+               BER_BVSTR( &mech, "SIMPLE" );
                /* accept "anonymous" binds */
-               if ( op->orb_cred.bv_len == 0 || op->o_req_ndn.bv_len == 0 ) {
+               if ( BER_BVISEMPTY( &op->orb_cred ) || BER_BVISEMPTY( &op->o_req_ndn ) ) {
                        rs->sr_err = LDAP_SUCCESS;
 
-                       if( op->orb_cred.bv_len &&
+                       if( !BER_BVISEMPTY( &op->orb_cred ) &&
                                !( global_allows & SLAP_ALLOW_BIND_ANON_CRED ))
                        {
                                /* cred is not empty, disallow */
                                rs->sr_err = LDAP_INVALID_CREDENTIALS;
 
-                       } else if ( op->o_req_ndn.bv_len &&
+                       } else if ( !BER_BVISEMPTY( &op->o_req_ndn ) &&
                                !( global_allows & SLAP_ALLOW_BIND_ANON_DN ))
                        {
                                /* DN is not empty, disallow */
@@ -429,7 +430,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                                op->o_protocol, 0, 0 );
                        goto cleanup;
                }
-               ber_str2bv( "KRBV4", sizeof("KRBV4")-1, 0, &mech );
+               BER_BVSTR( &mech, "KRBV4" );
 
        } else if ( op->orb_method == LDAP_AUTH_KRBV42 ) {
                rs->sr_err = LDAP_AUTH_METHOD_NOT_SUPPORTED;
@@ -531,18 +532,18 @@ fe_op_bind( Operation *op, SlapReply *rs )
                                BER_BVZERO( &op->o_req_dn );
                                op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
                                BER_BVZERO( &op->o_req_ndn );
-                               if ( op->o_conn->c_dn.bv_len != 0 ) {
+                               if ( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
                                        ber_len_t max = sockbuf_max_incoming_auth;
                                        ber_sockbuf_ctrl( op->o_conn->c_sb,
                                                LBER_SB_OPT_SET_MAX_INCOMING, &max );
                                }
                                /* log authorization identity */
                                Statslog( LDAP_DEBUG_STATS,
-                                       "conn=%lu op=%lu BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
-                                       op->o_connid, op->o_opid,
-                                       op->o_conn->c_dn.bv_val
-                                               ? op->o_conn->c_dn.bv_val : "<empty>",
-                                       mech.bv_val, 0 );
+                                       "%s BIND dn=\"%s\" mech=%s (SLAPI) ssf=0\n",
+                                       op->o_log_prefix,
+                                       BER_BVISNULL( &op->o_conn->c_dn )
+                                               ? "<empty>" : op->o_conn->c_dn.bv_val,
+                                       mech.bv_val, 0, 0 );
                                ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
                        }
                        goto cleanup;
@@ -562,7 +563,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        }
 
                        /* be_bind returns regular/global edn */
-                       if( op->orb_edn.bv_len ) {
+                       if( !BER_BVISEMPTY( &op->orb_edn ) ) {
                                op->o_conn->c_dn = op->orb_edn;
                        } else {
                                ber_dupbv(&op->o_conn->c_dn, &op->o_req_dn);
@@ -570,7 +571,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
 
                        ber_dupbv( &op->o_conn->c_ndn, &op->o_req_ndn );
 
-                       if( op->o_conn->c_dn.bv_len != 0 ) {
+                       if( !BER_BVISEMPTY( &op->o_conn->c_dn ) ) {
                                ber_len_t max = sockbuf_max_incoming_auth;
                                ber_sockbuf_ctrl( op->o_conn->c_sb,
                                        LBER_SB_OPT_SET_MAX_INCOMING, &max );
@@ -578,9 +579,9 @@ fe_op_bind( Operation *op, SlapReply *rs )
 
                        /* log authorization identity */
                        Statslog( LDAP_DEBUG_STATS,
-                               "conn=%lu op=%lu BIND dn=\"%s\" mech=%s ssf=0\n",
-                               op->o_connid, op->o_opid,
-                               op->o_conn->c_dn.bv_val, mech.bv_val, 0 );
+                               "%s BIND dn=\"%s\" mech=%s ssf=0\n",
+                               op->o_log_prefix,
+                               op->o_conn->c_dn.bv_val, mech.bv_val, 0, 0 );
 
                        Debug( LDAP_DEBUG_TRACE,
                                "do_bind: v%d bind: \"%s\" to \"%s\"\n",
@@ -591,7 +592,7 @@ fe_op_bind( Operation *op, SlapReply *rs )
                        /* send this here to avoid a race condition */
                        send_ldap_result( op, rs );
 
-               } else if (op->orb_edn.bv_val != NULL) {
+               } else if ( !BER_BVISNULL( &op->orb_edn ) ) {
                        free( op->orb_edn.bv_val );
                }
 
index 6a7d1d47aa7240b0769f33b722861355c3d2229f..506e34736b544fe232de94023956b90d182bdfc8 100644 (file)
@@ -140,9 +140,9 @@ fe_op_compare( Operation *op, SlapReply *rs )
                        ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
 
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu CMP dn=\"%s\" attr=\"%s\"\n",
-                       op->o_connid, op->o_opid, op->o_req_dn.bv_val,
-                       ava.aa_desc->ad_cname.bv_val, 0 );
+                       "%s CMP dn=\"%s\" attr=\"%s\"\n",
+                       op->o_log_prefix, op->o_req_dn.bv_val,
+                       ava.aa_desc->ad_cname.bv_val, 0, 0 );
 
                if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
                        send_ldap_result( op, rs );
@@ -161,9 +161,9 @@ fe_op_compare( Operation *op, SlapReply *rs )
                        ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
 
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu CMP dn=\"%s\" attr=\"%s\"\n",
-                       op->o_connid, op->o_opid, op->o_req_dn.bv_val,
-                       ava.aa_desc->ad_cname.bv_val, 0 );
+                       "%s CMP dn=\"%s\" attr=\"%s\"\n",
+                       op->o_log_prefix, op->o_req_dn.bv_val,
+                       ava.aa_desc->ad_cname.bv_val, 0, 0 );
 
                if( backend_check_restrictions( op, rs, NULL ) != LDAP_SUCCESS ) {
                        send_ldap_result( op, rs );
@@ -230,9 +230,9 @@ fe_op_compare( Operation *op, SlapReply *rs )
            op->o_req_dn.bv_val,
                ava.aa_desc->ad_cname.bv_val, ava.aa_value.bv_val );
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu CMP dn=\"%s\" attr=\"%s\"\n",
-           op->o_connid, op->o_opid, op->o_req_dn.bv_val,
-               ava.aa_desc->ad_cname.bv_val, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s CMP dn=\"%s\" attr=\"%s\"\n",
+               op->o_log_prefix, op->o_req_dn.bv_val,
+               ava.aa_desc->ad_cname.bv_val, 0, 0 );
 
 #if defined( LDAP_SLAPI )
 #define        pb      op->o_pb
index baab32cb15afff7d2eacdc24b519d3dba9a44e2f..44c4e9faf75e9fa8d837fa590c31dedafe7ec5a9 100644 (file)
@@ -1597,6 +1597,19 @@ connection_resched( Connection *conn )
        return 0;
 }
 
+static void
+connection_init_log_prefix( Operation *op )
+{
+       if ( op->o_connid == (unsigned long)(-1) ) {
+               snprintf( op->o_log_prefix, sizeof( op->o_log_prefix ),
+                               "conn=-1 op=%lu", op->o_opid );
+
+       } else {
+               snprintf( op->o_log_prefix, sizeof( op->o_log_prefix ),
+                               "conn=%lu op=%lu", op->o_connid, op->o_opid );
+       }
+}
+
 static int connection_op_activate( Operation *op )
 {
        int status;
@@ -1625,6 +1638,7 @@ static int connection_op_activate( Operation *op )
        }
 
        op->o_connid = op->o_conn->c_connid;
+       connection_init_log_prefix( op );
 
        LDAP_STAILQ_INSERT_TAIL( &op->o_conn->c_ops, op, o_next );
 
@@ -1701,6 +1715,7 @@ connection_fake_init(
 
        op->o_conn = conn;
        op->o_connid = op->o_conn->c_connid;
+       connection_init_log_prefix( op );
 
        op->o_time = slap_get_time();
 }
index 68799812eab3a76e6ac95f474323684ecd750340..8ba7e1409b20b10921814dbc87f56116bd9d6963 100644 (file)
@@ -749,8 +749,8 @@ static int parseProxyAuthz (
        op->o_dn.bv_val = NULL;
        op->o_ndn = dn;
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu PROXYAUTHZ dn=\"%s\"\n",
-           op->o_connid, op->o_opid, dn.bv_val, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s PROXYAUTHZ dn=\"%s\"\n",
+           op->o_log_prefix, dn.bv_val, 0, 0, 0 );
 
        /*
         * NOTE: since slap_sasl_getdn() returns a normalized dn,
index 3ee66eac7dbd41a86964a89c813d23089107f535..36a838b54a25fe36ff9649b8415b2677d01ca14d 100644 (file)
@@ -88,8 +88,8 @@ do_delete(
                goto cleanup;
        }
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu DEL dn=\"%s\"\n",
-               op->o_connid, op->o_opid, op->o_req_dn.bv_val, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s DEL dn=\"%s\"\n",
+               op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
 
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_delete( op, rs );
index 3f507f27f2c7e41c76823eb4450a841c05c44f84..04902fda87edf69a314ad69d8d62ea0d49b7ef26 100644 (file)
@@ -74,9 +74,9 @@ limits_get(
        assert( op );
        assert( limit );
 
-       Debug( LDAP_DEBUG_TRACE, "==> limits_get: conn=%lu op=%lu dn=\"%s\"\n",
-                       op->o_connid, op->o_opid,
-                       BER_BVISNULL( ndn ) ? "[anonymous]" : ndn->bv_val );
+       Debug( LDAP_DEBUG_TRACE, "==> limits_get: %s dn=\"%s\"\n",
+                       op->o_log_prefix,
+                       BER_BVISNULL( ndn ) ? "[anonymous]" : ndn->bv_val, 0 );
        /*
         * default values
         */
index f7dbeb026e48fd7ed92831ad2396557fe368bd33..9158546c1a387b30235cf5c4371ccd0d0c54da6d 100644 (file)
@@ -259,20 +259,20 @@ fe_op_modify( Operation *op, SlapReply *rs )
                char abuf[BUFSIZ/2], *ptr = abuf;
                int len = 0;
 
-               Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n",
-                       op->o_connid, op->o_opid, op->o_req_dn.bv_val, 0, 0 );
+               Statslog( LDAP_DEBUG_STATS, "%s MOD dn=\"%s\"\n",
+                       op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
 
                for ( tmp = modlist; tmp != NULL; tmp = tmp->sml_next ) {
                        if (len + 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
-                               Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
-                                   op->o_connid, op->o_opid, abuf, 0, 0 );
+                               Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
+                                   op->o_log_prefix, abuf, 0, 0, 0 );
 
-                       len = 0;
+                               len = 0;
                                ptr = abuf;
 
                                if( 1 + tmp->sml_type.bv_len > sizeof(abuf)) {
-                                       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
-                                               op->o_connid, op->o_opid, tmp->sml_type.bv_val, 0, 0 );
+                                       Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
+                                               op->o_log_prefix, tmp->sml_type.bv_val, 0, 0, 0 );
                                        continue;
                                }
                        }
@@ -284,8 +284,8 @@ fe_op_modify( Operation *op, SlapReply *rs )
                        len += tmp->sml_type.bv_len;
                }
                if (len) {
-                       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD attr=%s\n",
-                               op->o_connid, op->o_opid, abuf, 0, 0 );
+                       Statslog( LDAP_DEBUG_STATS, "%s MOD attr=%s\n",
+                               op->o_log_prefix, abuf, 0, 0, 0 );
                }
        }
 #endif /* LDAP_DEBUG */
index 6446a311af7b8791d23deb93efb4018fbac6f3ed..1cfd67326178960f2053ea48c742b6c71564cab6 100644 (file)
@@ -219,8 +219,8 @@ fe_op_modrdn( Operation *op, SlapReply *rs )
                goto cleanup;
        }
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MODRDN dn=\"%s\"\n",
-           op->o_connid, op->o_opid, op->o_req_dn.bv_val, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s MODRDN dn=\"%s\"\n",
+           op->o_log_prefix, op->o_req_dn.bv_val, 0, 0, 0 );
 
        manageDSAit = get_manageDSAit( op );
 
index b2f611c4eb0e193bcdeac381bf950c05ed040c9c..fe2f6e0c2f5384b601850964193395f226085577 100644 (file)
@@ -522,9 +522,9 @@ send_ldap_disconnect( Operation     *op, SlapReply *rs )
 
        if ( send_ldap_response( op, rs ) == SLAP_CB_CONTINUE ) {
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu DISCONNECT tag=%lu err=%d text=%s\n",
-                       op->o_connid, op->o_opid, rs->sr_tag, rs->sr_err,
-                       rs->sr_text ? rs->sr_text : "" );
+                       "%s DISCONNECT tag=%lu err=%d text=%s\n",
+                       op->o_log_prefix, rs->sr_tag, rs->sr_err,
+                       rs->sr_text ? rs->sr_text : "", 0 );
        }
 }
 
@@ -540,8 +540,8 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
        assert( !LDAP_API_ERROR( rs->sr_err ));
 
        Debug( LDAP_DEBUG_TRACE,
-               "send_ldap_result: conn=%lu op=%lu p=%d\n",
-               op->o_connid, op->o_opid, op->o_protocol );
+               "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",
@@ -607,14 +607,14 @@ slap_send_ldap_result( Operation *op, SlapReply *rs )
                                rs->sr_err, rs->sr_nentries );
 
                        Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu SEARCH RESULT tag=%lu err=%s text=%s\n",
-                               op->o_connid, op->o_opid, rs->sr_tag, nbuf,
-                               rs->sr_text ? rs->sr_text : "" );
+                       "%s SEARCH RESULT tag=%lu err=%s text=%s\n",
+                               op->o_log_prefix, rs->sr_tag, nbuf,
+                               rs->sr_text ? rs->sr_text : "", 0 );
                } else {
                        Statslog( LDAP_DEBUG_STATS,
-                               "conn=%lu op=%lu RESULT tag=%lu err=%d text=%s\n",
-                               op->o_connid, op->o_opid, rs->sr_tag, rs->sr_err,
-                               rs->sr_text ? rs->sr_text : "" );
+                               "%s RESULT tag=%lu err=%d text=%s\n",
+                               op->o_log_prefix, rs->sr_tag, rs->sr_err,
+                               rs->sr_text ? rs->sr_text : "", 0 );
                }
        }
 
@@ -1182,8 +1182,8 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
        }
 
-       Statslog( LDAP_DEBUG_STATS2, "conn=%lu op=%lu ENTRY dn=\"%s\"\n",
-           op->o_connid, op->o_opid, rs->sr_entry->e_dn, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS2, "%s ENTRY dn=\"%s\"\n",
+           op->o_log_prefix, rs->sr_entry->e_dn, 0, 0, 0 );
 
        Debug( LDAP_DEBUG_TRACE,
                "<= send_search_entry: conn %lu exit.\n", op->o_connid, 0, 0 );
@@ -1373,8 +1373,9 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
        }
 #endif
 
-       Statslog( LDAP_DEBUG_STATS2, "conn=%lu op=%lu REF dn=\"%s\"\n",
-               op->o_connid, op->o_opid, rs->sr_entry ? rs->sr_entry->e_dn : "(null)", 0, 0 );
+       Statslog( LDAP_DEBUG_STATS2, "%s REF dn=\"%s\"\n",
+               op->o_log_prefix, rs->sr_entry ? rs->sr_entry->e_dn : "(null)",
+               0, 0, 0 );
 
        Debug( LDAP_DEBUG_TRACE, "<= send_search_reference\n", 0, 0, 0 );
 
index 805e5a180fa811b0decc22739bded8105afccaf9..9c8043e5c688f598813fee52cdfa775d8351fdfa 100644 (file)
@@ -189,9 +189,9 @@ do_search(
 
                sprintf(abuf, "scope=%d deref=%d", op->ors_scope, op->ors_deref);
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu SRCH base=\"%s\" %s filter=\"%s\"\n",
-                       op->o_connid, op->o_opid, op->o_req_dn.bv_val, abuf,
-                       op->ors_filterstr.bv_val );
+                       "%s SRCH base=\"%s\" %s filter=\"%s\"\n",
+                       op->o_log_prefix, op->o_req_dn.bv_val, abuf,
+                       op->ors_filterstr.bv_val, 0 );
 
                for ( i = 0; i<siz; i++ ) {
                        alen = op->ors_attrs[i].an_name.bv_len;
@@ -199,8 +199,8 @@ do_search(
                                alen = sizeof(abuf)-1;
                        }
                        if (len && (len + 1 + alen >= sizeof(abuf))) {
-                               Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
-                                   op->o_connid, op->o_opid, abuf, 0, 0 );
+                               Statslog( LDAP_DEBUG_STATS, "%s SRCH attr=%s\n",
+                                   op->o_log_prefix, abuf, 0, 0, 0 );
                                len = 0;
                                ptr = abuf;
                        }
@@ -213,8 +213,8 @@ do_search(
                        *ptr = '\0';
                }
                if (len) {
-                       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n",
-                               op->o_connid, op->o_opid, abuf, 0, 0 );
+                       Statslog( LDAP_DEBUG_STATS, "%s SRCH attr=%s\n",
+                               op->o_log_prefix, abuf, 0, 0, 0 );
                }
        }
 
index e973c363db6e5006d6b4ee2ae1be77401dc69467..6dd71ad6513e8e53fd4c395c37810b2bd0112081 100644 (file)
@@ -2055,6 +2055,7 @@ typedef struct slap_gacl {
 typedef struct slap_op {
        unsigned long o_opid;   /* id of this operation */
        unsigned long o_connid; /* id of conn initiating this op */
+       char            o_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
        struct slap_conn *o_conn;       /* connection spawning this op */
        BackendDB       *o_bd;  /* backend DB processing this op */
 
index cc47ee736dfe4ca234b0770c0d3315f42df0b0bf..b953e3e3e59fe20c058dae833126a2dfa11d3702 100644 (file)
@@ -59,8 +59,8 @@ starttls_extop ( Operation *op, SlapReply *rs )
                ( op->o_conn->c_dn.bv_len != 0 ) )
        {
                Statslog( LDAP_DEBUG_STATS,
-                       "conn=%lu op=%lu AUTHZ anonymous mech=starttls ssf=0\n",
-                       op->o_connid, op->o_opid, 0, 0, 0 );
+                       "%s AUTHZ anonymous mech=starttls ssf=0\n",
+                       op->o_log_prefix, 0, 0, 0, 0 );
 
                /* force to anonymous */
                connection2anonymous( op->o_conn );
index 728eeea51cbae904a398dc3f86f76daec66403af..774253ef42083d5fa7b47f67c27ebd1600ba8b8a 100644 (file)
@@ -44,8 +44,8 @@ do_unbind( Operation *op, SlapReply *rs )
         *      UnBindRequest ::= NULL
         */
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu UNBIND\n", op->o_connid,
-           op->o_opid, 0, 0, 0 );
+       Statslog( LDAP_DEBUG_STATS, "%s UNBIND\n", op->o_log_prefix,
+               0, 0, 0, 0 );
 
        /* pass the unbind to all backends */
        backend_unbind( op, rs );