From: Pierangelo Masarati Date: Sun, 26 Sep 2004 23:00:00 +0000 (+0000) Subject: preformat "conn=%lu op=%lu" X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~498 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d026e2c9f7a390b6adf9b03af3ee125c2cd52958;p=openldap preformat "conn=%lu op=%lu" --- diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 1c3a5f2766..a1e9992870 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -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 */ diff --git a/servers/slapd/back-dnssrv/bind.c b/servers/slapd/back-dnssrv/bind.c index 529ced8a87..a5a3fe3d9b 100644 --- a/servers/slapd/back-dnssrv/bind.c +++ b/servers/slapd/back-dnssrv/bind.c @@ -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", diff --git a/servers/slapd/back-dnssrv/referral.c b/servers/slapd/back-dnssrv/referral.c index 05c19c6b60..1d5ba88edb 100644 --- a/servers/slapd/back-dnssrv/referral.c +++ b/servers/slapd/back-dnssrv/referral.c @@ -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 ); diff --git a/servers/slapd/back-dnssrv/search.c b/servers/slapd/back-dnssrv/search.c index cac168ad1a..40c03230f0 100644 --- a/servers/slapd/back-dnssrv/search.c +++ b/servers/slapd/back-dnssrv/search.c @@ -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", diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 55c9e8bb47..836e9d4ce5 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -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 : "", - 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 ) ? "" : 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 : "", + BER_BVISNULL( &op->o_conn->c_dn ) ? "" : 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 : "", - 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 ) + ? "" : 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 ); } diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index 6a7d1d47aa..506e34736b 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -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 diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index baab32cb15..44c4e9faf7 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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(); } diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 68799812ea..8ba7e1409b 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -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, diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index 3ee66eac7d..36a838b54a 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -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 ); diff --git a/servers/slapd/limits.c b/servers/slapd/limits.c index 3f507f27f2..04902fda87 100644 --- a/servers/slapd/limits.c +++ b/servers/slapd/limits.c @@ -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 */ diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index f7dbeb026e..9158546c1a 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -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 */ diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 6446a311af..1cfd673261 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -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 ); diff --git a/servers/slapd/result.c b/servers/slapd/result.c index b2f611c4eb..fe2f6e0c2f 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -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 ); diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 805e5a180f..9c8043e5c6 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -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; iors_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 ); } } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index e973c363db..6dd71ad651 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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 */ diff --git a/servers/slapd/starttls.c b/servers/slapd/starttls.c index cc47ee736d..b953e3e3e5 100644 --- a/servers/slapd/starttls.c +++ b/servers/slapd/starttls.c @@ -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 ); diff --git a/servers/slapd/unbind.c b/servers/slapd/unbind.c index 728eeea51c..774253ef42 100644 --- a/servers/slapd/unbind.c +++ b/servers/slapd/unbind.c @@ -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 );