]> git.sur5r.net Git - openldap/commitdiff
Statslog additions:
authorHoward Chu <hyc@openldap.org>
Mon, 16 Dec 2002 12:14:37 +0000 (12:14 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 16 Dec 2002 12:14:37 +0000 (12:14 +0000)
Added StatslogTest macro.
Added attributes to modify and search Statslog.
Added Statslog of SASL authcid.

servers/slapd/modify.c
servers/slapd/sasl.c
servers/slapd/search.c
servers/slapd/slap.h

index 49c657d5f8b761dfe1abd077492b6b3800e3cca2..d024953c7cd3522d2f9a2e8dfc661f118c049c89 100644 (file)
@@ -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 );
 
index 70c6127d78010c0bfdc0992fb46bca15682bf56c..9e3d72ae5589ffcbe103cd618be88a64693b88e2 100644 (file)
@@ -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;
index 3260f8ab3489078958f6914dbc64fac831e08c65..edbbeaa7977ab9d230e0908757bc7045277e724f 100644 (file)
@@ -24,6 +24,7 @@
 #include <ac/socket.h>
 
 #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<siz; i++ ) {
+                       if (len + 1 + an[i].an_name.bv_len > 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 );
 
index f441e585bcd5c8d787ee1634257f97bd1c43425f..9e6b0174142a06a866f5c11d03b79cfd0976c6c2 100644 (file)
@@ -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
 
 /*