From: Howard Chu Date: Mon, 16 Dec 2002 12:14:37 +0000 (+0000) Subject: Statslog additions: X-Git-Tag: NO_SLAP_OP_BLOCKS~670 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7c7daf8556705065f48b97b0cc8a4e282083b106;p=openldap Statslog additions: Added StatslogTest macro. Added attributes to modify and search Statslog. Added Statslog of SASL authcid. --- diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 49c657d5f8..d024953c7c 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -269,8 +269,32 @@ do_modify( } #endif - Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu MOD dn=\"%s\"\n", - op->o_connid, op->o_opid, dn.bv_val, 0, 0 ); + if ( StatslogTest( LDAP_DEBUG_STATS ) ) { + 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, dn.bv_val, 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 ); + len = 0; + ptr = abuf; + } + if (len) { + *ptr++ = ' '; + len++; + } + ptr = lutil_strcopy(ptr, tmp->sml_type.bv_val); + 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 ); + } + } manageDSAit = get_manageDSAit( op ); diff --git a/servers/slapd/sasl.c b/servers/slapd/sasl.c index 70c6127d78..9e3d72ae55 100644 --- a/servers/slapd/sasl.c +++ b/servers/slapd/sasl.c @@ -764,6 +764,12 @@ slap_sasl_authorize( } conn->c_sasl_dn = authzDN; + if (conn->c_sasl_bindop) { + Statslog( LDAP_DEBUG_STATS, + "conn=%lu op=%lu BIND authcid=\"%s\"\n", + conn->c_connid, conn->c_sasl_bindop->o_opid, + auth_identity, 0, 0); + } #ifdef NEW_LOGGING LDAP_LOG( TRANSPORT, ENTRY, @@ -882,6 +888,13 @@ slap_sasl_authorize( (long) (conn ? conn->c_connid : -1), 0, 0 ); #endif + if (conn->c_sasl_bindop) { + Statslog( LDAP_DEBUG_STATS, + "conn=%lu op=%lu BIND authcid=\"%s\"\n", + conn->c_connid, conn->c_sasl_bindop->o_opid, + auth_identity, 0, 0); + } + conn->c_sasl_dn = authzDN; *errstr = NULL; return SASL_OK; diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 3260f8ab34..edbbeaa797 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -24,6 +24,7 @@ #include #include "ldap_pvt.h" +#include "lutil.h" #include "slap.h" #include "slapi.h" @@ -213,9 +214,33 @@ do_search( Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 ); #endif - Statslog( LDAP_DEBUG_STATS, - "conn=%lu op=%lu SRCH base=\"%s\" scope=%d filter=\"%s\"\n", - op->o_connid, op->o_opid, pbase.bv_val, scope, fstr.bv_val ); + if ( StatslogTest( LDAP_DEBUG_STATS ) ) { + char abuf[BUFSIZ/2], *ptr = abuf; + int len = 0; + + Statslog( LDAP_DEBUG_STATS, + "conn=%lu op=%lu SRCH base=\"%s\" scope=%d filter=\"%s\"\n", + op->o_connid, op->o_opid, pbase.bv_val, scope, fstr.bv_val ); + + for ( i = 0; i sizeof(abuf)) { + Statslog( LDAP_DEBUG_STATS, "conn=%lu op=%lu SRCH attr=%s\n", + op->o_connid, op->o_opid, abuf, 0, 0 ); + len = 0; + ptr = abuf; + } + if (len) { + *ptr++ = ' '; + len++; + } + ptr = lutil_strcopy(ptr, an[i].an_name.bv_val); + len += an[i].an_name.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 ); + } + } manageDSAit = get_manageDSAit( op ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index f441e585bc..9e6b017414 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1879,12 +1879,14 @@ typedef struct slap_conn { syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \ (arg2), (arg3) ); \ } while (0) +#define StatslogTest( level ) ((ldap_debug | ldap_syslog) & (level)) #elif defined(LDAP_DEBUG) #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ do { \ if ( ldap_debug & (level) ) \ fprintf( stderr, (fmt), (connid), (opid), (arg1), (arg2), (arg3) );\ } while (0) +#define StatslogTest( level ) (ldap_debug & (level)) #elif defined(LDAP_SYSLOG) #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) \ do { \ @@ -1892,8 +1894,10 @@ typedef struct slap_conn { syslog( ldap_syslog_level, (fmt), (connid), (opid), (arg1), \ (arg2), (arg3) ); \ } while (0) +#define StatslogTest( level ) (ldap_syslog & (level)) #else #define Statslog( level, fmt, connid, opid, arg1, arg2, arg3 ) +#define StatslogTest( level ) (0) #endif /*