]> git.sur5r.net Git - openldap/commitdiff
more new logging (finally), behind NEW_LOGGING
authorGary Williams <gwilliams@openldap.org>
Thu, 11 Jan 2001 17:11:23 +0000 (17:11 +0000)
committerGary Williams <gwilliams@openldap.org>
Thu, 11 Jan 2001 17:11:23 +0000 (17:11 +0000)
servers/slapd/abandon.c
servers/slapd/acl.c
servers/slapd/add.c
servers/slapd/backend.c
servers/slapd/bind.c
servers/slapd/ch_malloc.c
servers/slapd/compare.c
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/controls.c

index 78c14be6ba2363a69477b730ebf8f37a9ab7596b..c60bc104670725b6ae02d6dceb3e468e4e4c6a4c 100644 (file)
@@ -35,7 +35,11 @@ do_abandon(
        Operation       **oo;
        int rc, notfound;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "conn: %d do_abandon\n", conn->c_connid));
+#else
        Debug( LDAP_DEBUG_TRACE, "do_abandon\n", 0, 0, 0 );
+#endif
 
        /*
         * Parse the abandon request.  It looks like this:
@@ -44,7 +48,13 @@ do_abandon(
         */
 
        if ( ber_scanf( op->o_ber, "i", &id ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR, 
+                       "conn: %d do_abandon: ber_scanf failed\n",
+                       conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_abandon: ber_scanf failed\n", 0, 0 ,0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                return -1;
@@ -55,11 +65,21 @@ do_abandon(
                return rc;
        } 
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+                   "do_abandon: conn: %d  id=%ld\n", conn->c_connid, (long) id ));
+#else
        Debug( LDAP_DEBUG_ARGS, "do_abandon: id=%ld\n", (long) id, 0 ,0 );
+#endif
 
        if( id <= 0 ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_abandon: conn: %d bad msgid %ld\n", conn->c_connid, (long) id ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "do_abandon: bad msgid %ld\n", (long) id, 0, 0 );
+#endif
                return LDAP_SUCCESS;
        }
 
@@ -99,8 +119,13 @@ do_abandon(
 done:
        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+                   "do_abandon: conn: %d op=%ld %sfound\n",
+                   conn->c_connid, (long)id, notfound ? "not " : "" ));
+#else
        Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n",
               (long) id, notfound ? "not " : "", 0 );
-
+#endif
        return LDAP_SUCCESS;
 }
index 7b5d30bff6dbeab941499291d6a038abff3e9232..4f38b8dba5bcbcb928fa5fffc1a801b070114b03 100644 (file)
@@ -92,10 +92,16 @@ access_allowed(
 
        regmatch_t       matches[MAXREMATCHES];
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+                   "access_allowed: conn %d %s access to \"%s\" \"%s\" requested\n",
+                   conn->c_connid, access2str( access ), e->e_dn, attr ));
+#else
        Debug( LDAP_DEBUG_ACL,
                "=> access_allowed: %s access to \"%s\" \"%s\" requested\n",
            access2str( access ),
                e->e_dn, attr );
+#endif
 
        assert( be != NULL );
        assert( e != NULL );
@@ -104,9 +110,15 @@ access_allowed(
 
        /* grant database root access */
        if ( be != NULL && be_isroot( be, op->o_ndn ) ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
+                       "access_allowed: conn %d root access granted\n",
+                       conn->c_connid));
+#else
                Debug( LDAP_DEBUG_ACL,
                    "<= root access granted\n",
                        0, 0, 0 );
+#endif
                return 1;
        }
 
@@ -119,30 +131,48 @@ access_allowed(
                && desc != slap_schema.si_ad_entry
                && desc != slap_schema.si_ad_children )
        {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "access_allowed: conn %d NoUserMod Operational attribute: %s access granted\n",
+                       conn->c_connid, attr ));
+#else
                Debug( LDAP_DEBUG_ACL, "NoUserMod Operational attribute:"
                        " %s access granted\n",
                        attr, 0, 0 );
+#endif
                return 1;
        }
 
        /* use backend default access if no backend acls */
        if( be != NULL && be->be_acl == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "access_allowed: conn %d backend default %s access %s to \"%s\"\n",
+                       conn->c_connid, access2str( access ),
+                       be->be_dfltaccess >= access ? "granted" : "denied", op->o_dn ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: backend default %s access %s to \"%s\"\n",
                        access2str( access ),
                        be->be_dfltaccess >= access ? "granted" : "denied", op->o_dn );
-
+#endif
                return be->be_dfltaccess >= access;
 
 #ifdef notdef
        /* be is always non-NULL */
        /* use global default access if no global acls */
        } else if ( be == NULL && global_acl == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "access_allowed: conn %d global default %s access %s to \"%s\"\n",
+                       conn->c_connid, access2str( access ),
+                       global_default_access >= access ? "granted" : "denied", op->o_dn ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: global default %s access %s to \"%s\"\n",
                        access2str( access ),
                        global_default_access >= access ? "granted" : "denied", op->o_dn );
-
+#endif
                return global_default_access >= access;
 #endif
        }
@@ -159,16 +189,25 @@ access_allowed(
                int i;
 
                for (i = 0; i < MAXREMATCHES && matches[i].rm_so > 0; i++) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "access_allowed: conn %d match[%d]:  %d %d ",
+                               conn->c_connid, i, (int)matches[i].rm_so, (int)matches[i].rm_eo ));
+#else
                        Debug( LDAP_DEBUG_ACL, "=> match[%d]: %d %d ", i,
                               (int)matches[i].rm_so, (int)matches[i].rm_eo );
-
+#endif
                        if( matches[i].rm_so <= matches[0].rm_eo ) {
                                int n;
                                for ( n = matches[i].rm_so; n < matches[i].rm_eo; n++) {
                                        Debug( LDAP_DEBUG_ACL, "%c", e->e_ndn[n], 0, 0 );
                                }
                        }
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "acl", LDAP_LEVEL_ARGS, "\n" ));
+#else
                        Debug( LDAP_DEBUG_ARGS, "\n", 0, 0, 0 );
+#endif
                }
 
                control = acl_mask( a, &mask, be, conn, op,
@@ -182,23 +221,41 @@ access_allowed(
        }
 
        if ( ACL_IS_INVALID( mask ) ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "access_allowed: conn %d  \"%s\" (%s) invalid!\n",
+                       conn->c_connid, e->e_dn, attr ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: \"%s\" (%s) invalid!\n",
                        e->e_dn, attr, 0 );
+#endif
                ACL_INIT( mask );
 
        } else if ( control == ACL_BREAK ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "access_allowed: conn %d  no more rules\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: no more rules\n", 0, 0, 0);
+#endif
                ACL_INIT( mask );
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+                   "access_allowed: conn %d  %s access %s by %s\n",
+                   access2str( access ),
+                   ACL_GRANT( mask, access ) ? "granted" : "denied",
+                   accessmask2str( mask, accessmaskbuf ) ));
+#else
        Debug( LDAP_DEBUG_ACL,
                "=> access_allowed: %s access %s by %s\n",
                access2str( access ),
                ACL_GRANT(mask, access) ? "granted" : "denied",
                accessmask2str( mask, accessmaskbuf ) );
-
+#endif
        return ACL_GRANT(mask, access);
 }
 
@@ -247,16 +304,26 @@ acl_get(
 
                if (a->acl_dn_pat != NULL) {
                        if ( a->acl_dn_style == ACL_STYLE_REGEX ) {
+#ifdef NEW_LOGGING
+                            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                                       "acl_get: dnpat [%d] %s nsub: %d\n",
+                                       *count, a->acl_dn_pat, (int) a->acl_dn_re.re_nsub ));
+#else
                                Debug( LDAP_DEBUG_ACL, "=> dnpat: [%d] %s nsub: %d\n", 
                                        *count, a->acl_dn_pat, (int) a->acl_dn_re.re_nsub );
-
+#endif
                                if (regexec(&a->acl_dn_re, e->e_ndn, nmatch, matches, 0))
                                        continue;
 
                        } else {
+#ifdef NEW_LOGGING
+                            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                                       "acl_get: dn [%d] %s\n",
+                                       *count, a->acl_dn_pat ));
+#else
                                Debug( LDAP_DEBUG_ACL, "=> dn: [%d] %s\n", 
                                        *count, a->acl_dn_pat, 0 );
-
+#endif
                                patlen = strlen( a->acl_dn_pat );
                                if ( dnlen < patlen )
                                        continue;
@@ -299,8 +366,14 @@ acl_get(
                                        continue;
                        }
 
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                                   "acl_get: [%d] matched\n",
+                                   *count ));
+#else
                        Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] matched\n",
                                *count, 0, 0 );
+#endif
                }
 
                if ( a->acl_filter != NULL ) {
@@ -310,21 +383,37 @@ acl_get(
                        }
                }
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                           "acl_get: [%d] check attr %s\n",
+                           *count, attr ));
+#else
         Debug( LDAP_DEBUG_ACL, "=> acl_get: [%d] check attr %s\n",
                        *count, attr, 0);
-
+#endif
                if ( attr == NULL || a->acl_attrs == NULL ||
                        ad_inlist( desc, a->acl_attrs ) )
                {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_get:  [%d] acl %s attr: %s\n",
+                               *count, e->e_dn, attr ));
+#else
                        Debug( LDAP_DEBUG_ACL,
                                "<= acl_get: [%d] acl %s attr: %s\n",
                                *count, e->e_dn, attr );
+#endif
                        return a;
                }
                matches[0].rm_so = matches[0].rm_eo = -1;
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+                   "acl_get: done.\n" ));
+#else
        Debug( LDAP_DEBUG_ACL, "<= acl_get: done.\n", 0, 0, 0 );
+#endif
        return( NULL );
 }
 
@@ -361,6 +450,17 @@ acl_mask(
        assert( a != NULL );
        assert( mask != NULL );
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "acl", LDAP_LEVEL_ENTRY,
+                   "acl_mask: conn %d  access to entry \"%s\", attr \"%s\" requested\n",
+                   conn->c_connid, e->e_dn, attr ));
+
+        LDAP_LOG(( "acl", LDAP_LEVEL_ARGS,
+                   " to %s by \"%s\", (%s) \n",
+                   val ? "value" : "all values",
+                   op->o_ndn ? op->o_ndn : "",
+                   accessmask2str( *mask, accessmaskbuf ) ));
+#else
        Debug( LDAP_DEBUG_ACL,
                "=> acl_mask: access to entry \"%s\", attr \"%s\" requested\n",
                e->e_dn, attr, 0 );
@@ -370,6 +470,7 @@ acl_mask(
                val ? "value" : "all values",
                op->o_ndn ?  op->o_ndn : "",
                accessmask2str( *mask, accessmaskbuf ) );
+#endif
 
        for ( i = 1, b = a->acl_access; b != NULL; b = b->a_next, i++ ) {
                slap_mask_t oldmask, modmask;
@@ -378,8 +479,14 @@ acl_mask(
 
                /* AND <who> clauses */
                if ( b->a_dn_pat != NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_dn_pat: %s\n",
+                               conn->c_connid, b->a_dn_pat ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_dn_pat: %s\n",
                                b->a_dn_pat, 0, 0);
+#endif
                        /*
                         * if access applies to the entry itself, and the
                         * user is bound as somebody in the same namespace as
@@ -464,8 +571,14 @@ acl_mask(
                }
 
                if ( b->a_sockurl_pat != NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_sockurl_pat: %s\n",
+                               conn->c_connid, b->a_sockurl_pat ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_sockurl_pat: %s\n",
                                b->a_sockurl_pat, 0, 0 );
+#endif
 
                        if ( strcmp( b->a_sockurl_pat, "*" ) != 0) {
                                if ( b->a_sockurl_style == ACL_STYLE_REGEX) {
@@ -482,9 +595,14 @@ acl_mask(
                }
 
                if ( b->a_domain_pat != NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_domain_pat: %s\n",
+                               conn->c_connid, b->a_domain_pat ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_domain_pat: %s\n",
                                b->a_domain_pat, 0, 0 );
-
+#endif
                        if ( strcmp( b->a_domain_pat, "*" ) != 0) {
                                if ( b->a_domain_style == ACL_STYLE_REGEX) {
                                        if (!regex_matches( b->a_domain_pat, conn->c_peer_domain,
@@ -500,9 +618,14 @@ acl_mask(
                }
 
                if ( b->a_peername_pat != NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_perrname_path: %s\n",
+                               conn->c_connid, b->a_peername_pat ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_peername_path: %s\n",
                                b->a_peername_pat, 0, 0 );
-
+#endif
                        if ( strcmp( b->a_peername_pat, "*" ) != 0) {
                                if ( b->a_peername_style == ACL_STYLE_REGEX) {
                                        if (!regex_matches( b->a_peername_pat, conn->c_peer_name,
@@ -518,9 +641,14 @@ acl_mask(
                }
 
                if ( b->a_sockname_pat != NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_sockname_path: %s\n",
+                               conn->c_connid, b->a_sockname_pat ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_sockname_path: %s\n",
                                b->a_sockname_pat, 0, 0 );
-
+#endif
                        if ( strcmp( b->a_sockname_pat, "*" ) != 0) {
                                if ( b->a_sockname_style == ACL_STYLE_REGEX) {
                                        if (!regex_matches( b->a_sockname_pat, conn->c_sock_name,
@@ -542,9 +670,14 @@ acl_mask(
                        const char *text;
                        const char *desc = b->a_dn_at->ad_cname->bv_val;
 
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                                   "acl_mask: conn %d  check a_dn_pat: %s\n",
+                                   conn->c_connid, desc ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_dn_at: %s\n",
                                desc, 0, 0);
-
+#endif
                        bv.bv_val = op->o_ndn;
                        bv.bv_len = strlen( bv.bv_val );
 
@@ -637,39 +770,59 @@ acl_mask(
                }
 
                if ( b->a_authz.sai_ssf ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_authz.sai_ssf: ACL %u > OP %u\n",
+                               conn->c_connid, b->a_authz.sai_ssf, op->o_ssf ));
+#else
                        Debug( LDAP_DEBUG_ACL, "<= check a_authz.sai_ssf: ACL %u > OP %u\n",
                                b->a_authz.sai_ssf, op->o_ssf, 0 );
-
+#endif
                        if ( b->a_authz.sai_ssf >  op->o_ssf ) {
                                continue;
                        }
                }
 
                if ( b->a_authz.sai_transport_ssf ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_authz.sai_transport_ssf: ACL %u > OP %u\n",
+                               conn->c_connid, b->a_authz.sai_transport_ssf, op->o_transport_ssf ));
+#else
                        Debug( LDAP_DEBUG_ACL,
                                "<= check a_authz.sai_transport_ssf: ACL %u > OP %u\n",
                                b->a_authz.sai_transport_ssf, op->o_transport_ssf, 0 );
-
+#endif
                        if ( b->a_authz.sai_transport_ssf >  op->o_transport_ssf ) {
                                continue;
                        }
                }
 
                if ( b->a_authz.sai_tls_ssf ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d  check a_authz.sai_tls_ssf: ACL %u > OP %u\n",
+                               conn->c_connid, b->a_authz.sai_tls_ssf, op->o_tls_ssf ));
+#else
                        Debug( LDAP_DEBUG_ACL,
                                "<= check a_authz.sai_tls_ssf: ACL %u > OP %u\n",
                                b->a_authz.sai_tls_ssf, op->o_tls_ssf, 0 );
-
+#endif
                        if ( b->a_authz.sai_tls_ssf >  op->o_tls_ssf ) {
                                continue;
                        }
                }
 
                if ( b->a_authz.sai_sasl_ssf ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                               "acl_mask: conn %d check a_authz.sai_sasl_ssf: ACL %u > OP %u\n",
+                               conn->c_connid, b->a_authz.sai_sasl_ssf, op->o_sasl_ssf ));
+#else
                        Debug( LDAP_DEBUG_ACL,
                                "<= check a_authz.sai_sasl_ssf: ACL %u > OP %u\n",
                                b->a_authz.sai_sasl_ssf, op->o_sasl_ssf, 0 );
-
+#endif
                        if ( b->a_authz.sai_sasl_ssf >  op->o_sasl_ssf ) {
                                continue;
                        }
@@ -757,7 +910,13 @@ acl_mask(
                        modmask = b->a_access_mask;
                }
 
-
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "acl", LDAP_LEVEL_RESULTS,
+                           "acl_mask: conn %d  [%d] applying %s (%s)\n",
+                           conn->c_connid, i, accessmask2str( modmask, accessmaskbuf),
+                           b->a_type == ACL_CONTINUE ? "continue" : b->a_type == ACL_BREAK
+                           ? "break" : "stop" ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "<= acl_mask: [%d] applying %s (%s)\n",
                        i, accessmask2str( modmask, accessmaskbuf ), 
@@ -766,7 +925,7 @@ acl_mask(
                                : b->a_type == ACL_BREAK
                                        ? "break"
                                        : "stop" );
-
+#endif
                /* save old mask */
                oldmask = *mask;
 
@@ -789,9 +948,15 @@ acl_mask(
                        *mask = modmask;
                }
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                           "acl_mask: conn %d  [%d] mask: %s\n",
+                           conn->c_connid, i, accessmask2str( *mask, accessmaskbuf) ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "<= acl_mask: [%d] mask: %s\n",
                        i, accessmask2str(*mask, accessmaskbuf), 0 );
+#endif
 
                if( b->a_type == ACL_CONTINUE ) {
                        continue;
@@ -804,9 +969,15 @@ acl_mask(
                }
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "aci", LDAP_LEVEL_RESULTS,
+                   "acl_mask: conn %d  no more <who> clauses, returning %d (stop)\n",
+                   conn->c_connid, accessmask2str( *mask, accessmaskbuf) ));
+#else
        Debug( LDAP_DEBUG_ACL,
                "<= acl_mask: no more <who> clauses, returning %s (stop)\n",
                accessmask2str(*mask, accessmaskbuf), 0, 0 );
+#endif
        return ACL_STOP;
 }
 
@@ -832,30 +1003,48 @@ acl_check_modlist(
 
        /* short circuit root database access */
        if ( be_isroot( be, op->o_ndn ) ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "acl", LDAP_LEVEL_DETAIL1,
+                       "acl_check_modlist: conn %d  access granted to root user\n",
+                       conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "<= acl_access_allowed: granted to database root\n",
                    0, 0, 0 );
+#endif
                return 1;
        }
 
        /* use backend default access if no backend acls */
        if( be != NULL && be->be_acl == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                       "acl_check_modlist: conn %d  backend default %s access %s to \"%s\"\n",
+                       conn->c_connid, access2str( ACL_WRITE ),
+                       be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: backend default %s access %s to \"%s\"\n",
                        access2str( ACL_WRITE ),
                        be->be_dfltaccess >= ACL_WRITE ? "granted" : "denied", op->o_dn );
-
+#endif
                return be->be_dfltaccess >= ACL_WRITE;
 
 #ifdef notdef
        /* be is always non-NULL */
        /* use global default access if no global acls */
        } else if ( be == NULL && global_acl == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                       "acl_check_modlist: conn %d  global default %s access %s to \"%s\"\n",
+                       conn->c_connid, access2str( ACL_WRITE ),
+                       global_default_access >= ACL_WRITE ? "granted" : "denied", op->o_dn ));
+#else
                Debug( LDAP_DEBUG_ACL,
                        "=> access_allowed: global default %s access %s to \"%s\"\n",
                        access2str( ACL_WRITE ),
                        global_default_access >= ACL_WRITE ? "granted" : "denied", op->o_dn );
-
+#endif
                return global_default_access >= ACL_WRITE;
 #endif
        }
@@ -867,9 +1056,15 @@ acl_check_modlist(
                 * by the user
                 */
                if ( is_at_no_user_mod( mlist->sml_desc->ad_type ) ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                               "acl_check_modlist: conn %d  no-user-mod %s: modify access granted\n",
+                               conn->c_connid, mlist->sml_desc->ad_cname->bv_val ));
+#else
                        Debug( LDAP_DEBUG_ACL, "acl: no-user-mod %s:"
                                " modify access granted\n",
                                mlist->sml_desc->ad_cname->bv_val, 0, 0 );
+#endif
                        continue;
                }
 
@@ -1511,8 +1706,15 @@ string_expand(
 
        *dp = '\0';
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                   "string_expand:  pattern = %s\n", pat ));
+        LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL1,
+                   "string_expand:  expanded = %s\n", newbuf ));
+#else
        Debug( LDAP_DEBUG_TRACE, "=> string_expand: pattern:  %s\n", pat, 0, 0 );
        Debug( LDAP_DEBUG_TRACE, "=> string_expand: expanded: %s\n", newbuf, 0, 0 );
+#endif
 }
 
 static int
@@ -1534,20 +1736,34 @@ regex_matches(
                char error[512];
                regerror(rc, &re, error, sizeof(error));
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "aci", LDAP_LEVEL_ERR,
+                           "regex_matches: compile( \"%s\", \"%s\") failed %s\n",
+                           pat, str, error ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                    "compile( \"%s\", \"%s\") failed %s\n",
                        pat, str, error );
+#endif
                return( 0 );
        }
 
        rc = regexec(&re, str, 0, NULL, 0);
        regfree( &re );
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL2,
+                   "regex_matches: string:   %s\n", str ));
+        LDAP_LOG(( "aci", LDAP_LEVEL_DETAIL2,
+                   "regex_matches: rc:  %d  %s\n",
+                   rc, rc ? "matches" : "no matches" ));
+#else
        Debug( LDAP_DEBUG_TRACE,
            "=> regex_matches: string:   %s\n", str, 0, 0 );
        Debug( LDAP_DEBUG_TRACE,
            "=> regex_matches: rc: %d %s\n",
                rc, !rc ? "matches" : "no matches", 0 );
+#endif
        return( !rc );
 }
 
index c0c5a920a13005feeeefe8099946d952bea6edc9..bb549fba3904953d6e5d953fecbb7ca4e177688d 100644 (file)
@@ -46,8 +46,12 @@ do_add( Connection *conn, Operation *op )
        int                     rc = LDAP_SUCCESS;
        int     manageDSAit;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+                   "do_add: conn %d enter\n", conn->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE, "do_add\n", 0, 0, 0 );
-
+#endif
        /*
         * Parse the add request.  It looks like this:
         *
@@ -62,7 +66,12 @@ do_add( Connection *conn, Operation *op )
 
        /* get the name */
        if ( ber_scanf( ber, "{a", /*}*/ &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_add: conn %d ber_scanf failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                return -1;
@@ -71,7 +80,12 @@ do_add( Connection *conn, Operation *op )
        ndn = ch_strdup( dn );
 
        if ( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_add: conn %d  invalid dn (%s)\n", conn->c_connid, dn ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_add: invalid dn (%s)\n", dn, 0, 0 );
+#endif
                send_ldap_result( conn, op, LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
                free( dn );
@@ -86,7 +100,12 @@ do_add( Connection *conn, Operation *op )
        e->e_attrs = NULL;
        e->e_private = NULL;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+                   "do_add: conn %d  ndn (%s)\n", conn->c_connid, e->e_ndn ));
+#else
        Debug( LDAP_DEBUG_ARGS, "do_add: ndn (%s)\n", e->e_ndn, 0, 0 );
+#endif
 
        /* get the attrs */
        for ( tag = ber_first_element( ber, &len, &last ); tag != LBER_DEFAULT;
@@ -99,7 +118,12 @@ do_add( Connection *conn, Operation *op )
                rc = ber_scanf( ber, "{a{V}}", &mod->ml_type, &mod->ml_bvalues );
 
                if ( rc == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                               "do_add: conn %d  decoding error \n", conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_ANY, "do_add: decoding error\n", 0, 0, 0 );
+#endif
                        send_ldap_disconnect( conn, op,
                                LDAP_PROTOCOL_ERROR, "decoding error" );
                        rc = -1;
@@ -108,8 +132,14 @@ do_add( Connection *conn, Operation *op )
                }
 
                if ( mod->ml_bvalues == NULL ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                               "do_add: conn %d  no values for type %s\n",
+                               conn->c_connid, mod->ml_type ));
+#else
                        Debug( LDAP_DEBUG_ANY, "no values for type %s\n",
                                mod->ml_type, 0, 0 );
+#endif
                        send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
                                NULL, "no values for attribute type", NULL, NULL );
                        free( mod->ml_type );
@@ -122,7 +152,12 @@ do_add( Connection *conn, Operation *op )
        }
 
        if ( ber_scanf( ber, /*{*/ "}") == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_add: conn %d  ber_scanf failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_add: ber_scanf failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                rc = -1;
@@ -130,7 +165,12 @@ do_add( Connection *conn, Operation *op )
        }
 
        if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_add: conn %d  get_ctrls failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_add: get_ctrls failed\n", 0, 0, 0 );
+#endif
                goto done;
        } 
 
@@ -252,9 +292,14 @@ do_add( Connection *conn, Operation *op )
 #endif
                }
        } else {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_add: conn %d  no backend support\n", conn->c_connid ));
+#else
            Debug( LDAP_DEBUG_ARGS, "    do_add: no backend support\n", 0, 0, 0 );
-               send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
-                       NULL, "operation not supported within namingContext", NULL, NULL );
+#endif
+            send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
+                              NULL, "operation not supported within namingContext", NULL, NULL );
        }
 
 done:
index d05df370751cacf6fbea63c59f02fed5652021f8..486e37ff38bfdee7d6caa9116eeaec1ffc85000b 100644 (file)
@@ -96,8 +96,13 @@ int backend_init(void)
 
        if((nBackendInfo != 0) || (backendInfo != NULL)) {
                /* already initialized */
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+                      "backend_init:  backend already initialized\n" ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "backend_init: already initialized.\n", 0, 0, 0 );
+#endif
                return -1;
        }
 
@@ -108,10 +113,15 @@ int backend_init(void)
                rc = binfo[nBackendInfo].bi_init( &binfo[nBackendInfo] );
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+                               "backend_init:  initialized for type \"%s\"\n",
+                               binfo[nBackendInfo].bi_type ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_init: initialized for type \"%s\"\n",
                                        binfo[nBackendInfo].bi_type, 0, 0 );
-
+#endif
                        /* destroy those we've already inited */
                        for( nBackendInfo--;
                                nBackendInfo >= 0 ;
@@ -134,9 +144,15 @@ int backend_init(void)
 #ifdef SLAPD_MODULES   
        return 0;
 #else
-       Debug( LDAP_DEBUG_ANY,
+
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+                   "backend_init: failed\n" ));
+#else
+        Debug( LDAP_DEBUG_ANY,
                "backend_init: failed\n",
                0, 0, 0 );
+#endif
 
        return rc;
 #endif /* SLAPD_MODULES */
@@ -147,9 +163,15 @@ int backend_add(BackendInfo *aBackendInfo)
    int rc = 0;
 
    if ((rc = aBackendInfo->bi_init(aBackendInfo)) != 0) {
+#ifdef NEW_LOGGING
+       LDAP_LOG(( "backend", LDAP_LEVEL_ERR,
+                  "backend_add:  initialization for type \"%s\" failed\n",
+                  aBackendInfo->bi_type ));
+#else
       Debug( LDAP_DEBUG_ANY,
             "backend_add: initialization for type \"%s\" failed\n",
             aBackendInfo->bi_type, 0, 0 );
+#endif
       return rc;
    }
 
@@ -182,26 +204,44 @@ int backend_startup(Backend *be)
 
        if( ! ( nBackendDB > 0 ) ) {
                /* no databases */
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
+                       "backend_startup: %d databases to startup. \n",
+                       nBackendDB ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "backend_startup: %d databases to startup.\n",
                        nBackendDB, 0, 0 );
+#endif
                return 1;
        }
 
        if(be != NULL) {
                /* startup a specific backend database */
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "backend", LDAP_LEVEL_DETAIL1,
+                       "backend_startup:  starting \"%s\"\n",
+                       be->be_suffix[0] ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "backend_startup: starting \"%s\"\n",
                        be->be_suffix[0], 0, 0 );
+#endif
 
                if ( be->bd_info->bi_open ) {
                        rc = be->bd_info->bi_open( be->bd_info );
                }
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+                               "backend_startup: bi_open failed!\n" ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_startup: bi_open failed!\n",
                                0, 0, 0 );
+#endif
+
                        return rc;
                }
 
@@ -210,9 +250,14 @@ int backend_startup(Backend *be)
                }
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+                               "backend_startup: bi_db_open failed!\n" ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_startup: bi_db_open failed!\n",
                                0, 0, 0 );
+#endif
                        return rc;
                }
 
@@ -232,9 +277,14 @@ int backend_startup(Backend *be)
                }
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+                               "backend_startup: bi_open %d failed!\n", i ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_startup: bi_open %d failed!\n",
                                i, 0, 0 );
+#endif
                        return rc;
                }
        }
@@ -250,9 +300,14 @@ int backend_startup(Backend *be)
                }
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_CRIT,
+                               "backend_startup: bi_db_open %d failed!\n", i ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_startup: bi_db_open %d failed!\n",
                                i, 0, 0 );
+#endif
                        return rc;
                }
        }
@@ -304,9 +359,15 @@ int backend_shutdown( Backend *be )
                }
 
                if(rc != 0) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "backend", LDAP_LEVEL_NOTICE,
+                               "backend_shutdown: bi_close %s failed!\n",
+                               backendDB[i].be_type ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "backend_close: bi_close %s failed!\n",
                                backendDB[i].be_type, 0, 0 );
+#endif
                }
        }
 
index 9f3f5427b2c648f76a7db957d13da9cb0422b408..6d5c39bb3c1654a3ac3a602095d460567e8dbfe8 100644 (file)
@@ -45,7 +45,11 @@ do_bind(
        struct berval   cred;
        Backend         *be;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY, "do_bind: conn %d\n", conn->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE, "do_bind\n", 0, 0, 0 );
+#endif
 
        dn = NULL;
        ndn = NULL;
@@ -92,7 +96,12 @@ do_bind(
        tag = ber_scanf( ber, "{iat" /*}*/, &version, &dn, &method );
 
        if ( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_bind: conn %d  ber_scanf failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "bind: ber_scanf failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                rc = -1;
@@ -134,33 +143,61 @@ do_bind(
        }
 
        if( (rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_bind: conn %d  get_ctrls failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_bind: get_ctrls failed\n", 0, 0, 0 );
+#endif
                goto cleanup;
        } 
 
        ndn = ch_strdup( dn );
 
        if ( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_bind: conn %d  invalid dn (%s)\n", conn->c_connid, dn ));
+#else
                Debug( LDAP_DEBUG_ANY, "bind: invalid dn (%s)\n", dn, 0, 0 );
+#endif
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
                goto cleanup;
        }
 
        if( method == LDAP_AUTH_SASL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation",  LDAP_LEVEL_DETAIL1,
+                       "do_sasl_bind: conn %d  dn (%s) mech %s\n", conn->c_connid,
+                       dn, mech ));
+#else
                Debug( LDAP_DEBUG_TRACE, "do_sasl_bind: dn (%s) mech %s\n",
                        dn, mech, NULL );
+#endif
        } else {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                       "do_bind: conn %d  version=%ld dn=\"%s\" method=%ld\n",
+                       conn->c_connid, (unsigned long) version, dn, (unsigned long)method ));
+#else
                Debug( LDAP_DEBUG_TRACE, "do_bind: version=%ld dn=\"%s\" method=%ld\n",
                        (unsigned long) version, dn, (unsigned long) method );
+#endif
        }
 
-       Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d BIND dn=\"%s\" method=%ld\n",
+        Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d BIND dn=\"%s\" method=%ld\n",
            op->o_connid, op->o_opid, ndn, (unsigned long) method, 0 );
 
        if ( version < LDAP_VERSION_MIN || version > LDAP_VERSION_MAX ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_bind: conn %d  unknown version = %ld\n",
+                       conn->c_connid, (unsigned long)version ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_bind: unknown version=%ld\n",
                        (unsigned long) version, 0, 0 );
+#endif
                send_ldap_result( conn, op, rc = LDAP_PROTOCOL_ERROR,
                        NULL, "requested protocol version not supported", NULL, NULL );
                goto cleanup;
@@ -185,8 +222,14 @@ do_bind(
                slap_ssf_t ssf = 0;
 
                if ( version < LDAP_VERSION3 ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                               "do_bind: conn %d  sasl with LDAPv%ld\n",
+                               conn->c_connid, (unsigned long)version ));
+#else
                        Debug( LDAP_DEBUG_ANY, "do_bind: sasl with LDAPv%ld\n",
                                (unsigned long) version, 0, 0 );
+#endif
                        send_ldap_disconnect( conn, op,
                                LDAP_PROTOCOL_ERROR, "SASL bind requires LDAPv3" );
                        rc = SLAPD_DISCONNECT;
@@ -194,9 +237,15 @@ do_bind(
                }
 
                if( mech == NULL || *mech == '\0' ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                               "do_bind: conn %d  no SASL mechanism provided\n",
+                               conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_ANY,
                                "do_bind: no sasl mechanism provided\n",
                                0, 0, 0 );
+#endif
                        send_ldap_result( conn, op, rc = LDAP_AUTH_METHOD_NOT_SUPPORTED,
                                NULL, "no SASL mechanism provided", NULL, NULL );
                        goto cleanup;
@@ -286,8 +335,14 @@ do_bind(
                         */
                        send_ldap_result( conn, op, rc,
                                NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                                   "do_bind: conn %d  v%d anonymous bind\n",
+                                   conn->c_connid, version ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "do_bind: v%d anonymous bind\n",
                                version, 0, 0 );
+#endif
                        goto cleanup;
 
                } else if ( global_disallows & SLAP_DISALLOW_BIND_SIMPLE ) {
@@ -297,9 +352,15 @@ do_bind(
 
                        send_ldap_result( conn, op, rc,
                                NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                   "do_bind: conn %d  v%d simple bind(%s) disallowed\n",
+                                   conn->c_connid, version, ndn ));
+#else
                        Debug( LDAP_DEBUG_TRACE,
                                "do_bind: v%d simple bind(%s) disallowed\n",
                                version, ndn, 0 );
+#endif
                        goto cleanup;
                }
 
@@ -312,8 +373,14 @@ do_bind(
 
                        send_ldap_result( conn, op, rc,
                                NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                                   "do_bind: conn %d  v%d Kerberos V4 bind\n",
+                                   conn->c_connid, version ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "do_bind: v%d Kerberos V4 bind\n",
                                version, 0, 0 );
+#endif
                        goto cleanup;
                }
 #endif
@@ -324,9 +391,15 @@ do_bind(
 
                send_ldap_result( conn, op, rc,
                        NULL, text, NULL, NULL );
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                           "do_bind: conn %d  v%d unknown authentication method (%d)\n",
+                           conn->c_connid, version, method ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "do_bind: v%d unknown authentication method (%d)\n",
                        version, method, 0 );
+#endif
                goto cleanup;
        }
 
@@ -384,8 +457,14 @@ do_bind(
                                ndn = NULL;
                        }
 
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                                   "do_bind: conn %d  v%d bind: \"%s\" to \"%s\" \n",
+                                   conn->c_connid, version, conn->c_cdn, conn->c_dn ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "do_bind: v%d bind: \"%s\" to \"%s\"\n",
                        version, conn->c_cdn, conn->c_dn );
+#endif
 
                        ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
 
index 9eb248e6ffea4dab75e8c583d6e4433925768d30..e08d7214b6b5ea5cd4e493517a8626f945d495e8 100644 (file)
@@ -28,8 +28,14 @@ ch_malloc(
        void    *new;
 
        if ( (new = (void *) ber_memalloc( size )) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "ch_malloc: allocation of %lu bytes failed\n",
+                       (long)size ));
+#else
                Debug( LDAP_DEBUG_ANY, "ch_malloc of %lu bytes failed\n",
                        (long) size, 0, 0 );
+#endif
                assert( 0 );
                exit( EXIT_FAILURE );
        }
@@ -54,8 +60,13 @@ ch_realloc(
        }
 
        if ( (new = (void *) ber_memrealloc( block, size )) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "ch_realloc: reallocation of %lu bytes failed\n", (long)size ));
+#else
                Debug( LDAP_DEBUG_ANY, "ch_realloc of %lu bytes failed\n",
                        (long) size, 0, 0 );
+#endif
                assert( 0 );
                exit( EXIT_FAILURE );
        }
@@ -72,8 +83,14 @@ ch_calloc(
        void    *new;
 
        if ( (new = (void *) ber_memcalloc( nelem, size )) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "ch_calloc: allocation of %lu elements of %lu bytes faild\n",
+                       (long)nelem, (long)size ));
+#else
                Debug( LDAP_DEBUG_ANY, "ch_calloc of %lu elems of %lu bytes failed\n",
                  (long) nelem, (long) size, 0 );
+#endif
                assert( 0 );
                exit( EXIT_FAILURE );
        }
@@ -89,7 +106,12 @@ ch_strdup(
        char    *new;
 
        if ( (new = ber_strdup( string )) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "chr_strdup: duplication of \"%s\" failed\n", string ));
+#else
                Debug( LDAP_DEBUG_ANY, "ch_strdup(%s) failed\n", string, 0, 0 );
+#endif
                assert( 0 );
                exit( EXIT_FAILURE );
        }
index 262304a514770b265a6c4e134c09bb862caaaef3..9a905281c2bd0ab37e70c5f6513850776e75838c 100644 (file)
@@ -43,8 +43,12 @@ do_compare(
        desc.bv_val = NULL;
        value.bv_val = NULL;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+                   "do_compare: conn %d\n", conn->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE, "do_compare\n", 0, 0, 0 );
-
+#endif
        /*
         * Parse the compare request.  It looks like this:
         *
@@ -58,14 +62,24 @@ do_compare(
         */
 
        if ( ber_scanf( op->o_ber, "{a" /*}*/, &dn ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_compare: conn %d  ber_scanf failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                return SLAPD_DISCONNECT;
        }
 
        if ( ber_scanf( op->o_ber, "{oo}", &desc, &value ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_compare: conn %d  get ava failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_compare: get ava failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                rc = SLAPD_DISCONNECT;
@@ -73,7 +87,12 @@ do_compare(
        }
 
        if ( ber_scanf( op->o_ber, /*{*/ "}" ) == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
+                       "do_compare: conn %d  ber_scanf failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "ber_scanf failed\n", 0, 0, 0 );
+#endif
                send_ldap_disconnect( conn, op,
                        LDAP_PROTOCOL_ERROR, "decoding error" );
                rc = SLAPD_DISCONNECT;
@@ -81,21 +100,38 @@ do_compare(
        }
 
        if( ( rc = get_ctrls( conn, op, 1 )) != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_compare: conn %d  get_ctrls failed\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_compare: get_ctrls failed\n", 0, 0, 0 );
+#endif
                goto cleanup;
        } 
 
        ndn = ch_strdup( dn );
 
        if( dn_normalize( ndn ) == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                       "do_compare: conn %d  invalid dn (%s)\n",
+                       conn->c_connid, dn ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_compare: invalid dn (%s)\n", dn, 0, 0 );
+#endif
                send_ldap_result( conn, op, rc = LDAP_INVALID_DN_SYNTAX, NULL,
                    "invalid DN", NULL, NULL );
                goto cleanup;
        }
 
        if( ndn == '\0' ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "operation", LDAP_LEVEL_DETAIL1,
+                       "do_compare: conn %d  compare to root DSE!\n",
+                       conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "do_compare: root dse!\n", 0, 0, 0 );
+#endif
                send_ldap_result( conn, op, rc = LDAP_UNWILLING_TO_PERFORM,
                        NULL, "compare upon the root DSE not supported", NULL, NULL );
                goto cleanup;
@@ -153,8 +189,15 @@ do_compare(
 
        ava.aa_value = nvalue;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ARGS,
+                   "do_compare: conn %d  dn (%s) attr(%s) value (%s)\n",
+                   conn->c_connid, dn, ava.aa_desc->ad_cname->bv_val,
+                   ava.aa_value->bv_val ));
+#else
        Debug( LDAP_DEBUG_ARGS, "do_compare: dn (%s) attr (%s) value (%s)\n",
            dn, ava.aa_desc->ad_cname->bv_val, ava.aa_value->bv_val );
+#endif
 
        Statslog( LDAP_DEBUG_STATS, "conn=%ld op=%d CMP dn=\"%s\" attr=\"%s\"\n",
            op->o_connid, op->o_opid, dn, ava.aa_desc->ad_cname->bv_val, 0 );
index b96596cf9f1b9da71a2d0e3917d19614ae86f8cc..90923bd989a7321e91c8b90890cad735daf60ca7 100644 (file)
@@ -132,8 +132,6 @@ read_config( const char *fname )
                                    cargv[1], 0, 0 );
                                return( 1 );
                        }
-
-               /* start of a new database definition */
                } else if ( strcasecmp( cargv[0], "database" ) == 0 ) {
                        if ( cargc < 2 ) {
                                Debug( LDAP_DEBUG_ANY,
@@ -800,8 +798,6 @@ read_config( const char *fname )
                                        return( 1 );
                                }
                        }
-
-               
                /* where to send clients when we don't hold it */
                } else if ( strcasecmp( cargv[0], "referral" ) == 0 ) {
                        if ( cargc < 2 ) {
@@ -815,18 +811,6 @@ read_config( const char *fname )
                        vals[0]->bv_len = strlen( vals[0]->bv_val );
                        value_add( &default_referral, vals );
 
-               } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
-                        int level;
-                       if ( cargc < 3 ) {
-                               Debug( LDAP_DEBUG_ANY,
-                                       "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
-                                       fname, lineno, 0 );
-                               return( 1 );
-                       }
-                        level = atoi( cargv[2] );
-                        if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
-                        lutil_set_debug_level( cargv[1], level );
-               /* specify an Object Identifier macro */
 #ifdef NEW_LOGGING
                 } else if ( strcasecmp( cargv[0], "logfile" ) == 0 ) {
                         FILE *logfile;
@@ -840,6 +824,19 @@ read_config( const char *fname )
                         if ( logfile != NULL ) lutil_debug_file( logfile );
 
 #endif
+               /* start of a new database definition */
+               } else if ( strcasecmp( cargv[0], "debug" ) == 0 ) {
+                        int level;
+                       if ( cargc < 3 ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                       "%s: line %d: Error in debug directive, \"debug subsys level\"\n",
+                                       fname, lineno, 0 );
+                               return( 1 );
+                       }
+                        level = atoi( cargv[2] );
+                        if ( level <= 0 ) level = lutil_mnem2level( cargv[2] );
+                        lutil_set_debug_level( cargv[1], level );
+               /* specify an Object Identifier macro */
                } else if ( strcasecmp( cargv[0], "objectidentifier" ) == 0 ) {
                        parse_oidm( fname, lineno, cargc, cargv );
 
index 9ba74d49a002d54e073494901ede3f291fa77475..6ee25228e39fae34a827821cd003b1894c7318d1 100644 (file)
@@ -73,8 +73,13 @@ int connections_init(void)
        assert( connections == NULL );
 
        if( connections != NULL) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connections_init:  already initialized.\n" ));
+#else
                Debug( LDAP_DEBUG_ANY, "connections_init: already initialized.\n",
                        0, 0, 0 );
+#endif
                return -1;
        }
 
@@ -84,9 +89,15 @@ int connections_init(void)
        connections = (Connection *) calloc( dtblsize, sizeof(Connection) );
 
        if( connections == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connections_init: allocation (%d * %ld) of connection array failed\n",
+                       dtblsize, (long) sizeof(Connection) ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "connections_init: allocation (%d*%ld) of connection array failed\n",
                        dtblsize, (long) sizeof(Connection), 0 );
+#endif
                return -1;
        }
 
@@ -111,8 +122,13 @@ int connections_destroy(void)
        /* should check return of every call */
 
        if( connections == NULL) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connections_destroy: nothing to destroy.\n"));
+#else
                Debug( LDAP_DEBUG_ANY, "connections_destroy: nothing to destroy.\n",
                        0, 0, 0 );
+#endif
                return -1;
        }
 
@@ -191,9 +207,14 @@ static Connection* connection_get( ber_socket_t s )
 
        Connection *c;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "connection", LDAP_LEVEL_ENTRY,
+                   "connection_get: socket %ld\n", (long)s ));
+#else
        Debug( LDAP_DEBUG_ARGS,
                "connection_get(%ld)\n",
                (long) s, 0, 0 );
+#endif
 
        assert( connections != NULL );
 
@@ -251,17 +272,27 @@ static Connection* connection_get( ber_socket_t s )
                        assert( c->c_conn_state == SLAP_C_INVALID );
                        assert( sd == AC_SOCKET_INVALID );
 
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "connection", LDAP_LEVEL_ARGS,
+                                   "connection_get:  connection %d not used\n", s ));
+#else
                        Debug( LDAP_DEBUG_TRACE,
                                "connection_get(%d): connection not used\n",
                                s, 0, 0 );
+#endif
 
                        ldap_pvt_thread_mutex_unlock( &c->c_mutex );
                        return NULL;
                }
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
+                           "connection_get: get for %d got connid %ld\n",s, c->c_connid ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "connection_get(%d): got connid=%ld\n",
                        s, c->c_connid, 0 );
+#endif
 
                c->c_n_get++;
 
@@ -304,9 +335,14 @@ long connection_init(
 #endif
 
        if( s == AC_SOCKET_INVALID ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_init: init of socket %ld invalid.\n", (long)s ));
+#else
         Debug( LDAP_DEBUG_ANY,
                        "connection_init(%ld): invalid.\n",
                        (long) s, 0, 0 );
+#endif
                return -1;
        }
 
@@ -351,9 +387,15 @@ long connection_init(
         }
 
         if( c == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_init: skt %d  connection table full (%d/%d)\n",
+                       s, i, dtblsize ));
+#else
                Debug( LDAP_DEBUG_ANY,
                                "connection_init(%d): connection table full (%d/%d)\n",
                                s, i, dtblsize);
+#endif
             ldap_pvt_thread_mutex_unlock( &connections_mutex );
             return -1;
         }
@@ -443,9 +485,15 @@ long connection_init(
        if( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_NONBLOCK,
                c /* non-NULL */ ) < 0 )
        {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_init: conn %d  set nonblocking failed\n",
+                       c->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "connection_init(%d, %s): set nonblocking failed\n",
                        s, c->c_peer_name, 0 );
+#endif
        }
 
     id = c->c_connid = conn_nextid++;
@@ -632,10 +680,15 @@ void connection_closing( Connection *c )
                ber_socket_t    sd;
 
                ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                           "connection_closing: conn %d readying socket %d for close.\n",
+                           c->c_connid, sd ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "connection_closing: readying conn=%ld sd=%d for close\n",
                        c->c_connid, sd, 0 );
-
+#endif
                /* update state to closing */
                c->c_conn_state = SLAP_C_CLOSING;
 
@@ -664,16 +717,26 @@ static void connection_close( Connection *c )
 
        ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_GET_FD, &sd );
        if( c->c_ops != NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                       "connection_close: conn %d  deferring sd %d\n",
+                       c->c_connid, sd ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "connection_close: deferring conn=%ld sd=%d\n",
                        c->c_connid, sd, 0 );
-
+#endif
                return;
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "connection", LDAP_LEVEL_RESULTS,
+                   "connection_close: conn %d  sd %d\n",
+                   c->c_connid, sd ));
+#else
        Debug( LDAP_DEBUG_TRACE, "connection_close: conn=%ld sd=%d\n",
                c->c_connid, sd, 0 );
-
+#endif
        connection_destroy( c );
 }
 
@@ -772,9 +835,15 @@ connection_operation( void *arg_v )
        ldap_pvt_thread_mutex_unlock( &num_ops_mutex );
 
        if( conn->c_sasl_bind_in_progress && tag != LDAP_REQ_BIND ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_operation: conn %d  SASL bind in progress (tag=%ld).\n",
+                       conn->c_connid, (long)tag ));
+#else
                Debug( LDAP_DEBUG_ANY, "connection_operation: "
                        "error: SASL bind in progress (tag=%ld).\n",
                        (long) tag, 0, 0 );
+#endif
                send_ldap_result( conn, arg->co_op,
                        rc = LDAP_OPERATIONS_ERROR,
                        NULL, "SASL bind in progress", NULL, NULL );
@@ -823,8 +892,14 @@ connection_operation( void *arg_v )
                break;
 
        default:
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_operation: conn %d  unknown LDAP request 0x%lx\n",
+                       conn->c_connid, tag ));
+#else
                Debug( LDAP_DEBUG_ANY, "unknown LDAP request 0x%lx\n",
                    tag, 0, 0 );
+#endif
                arg->co_op->o_tag = LBER_ERROR;
                send_ldap_disconnect( conn, arg->co_op,
                        LDAP_PROTOCOL_ERROR, "unknown LDAP request" );
@@ -886,10 +961,15 @@ int connection_read(ber_socket_t s)
        c = connection_get( s );
 
        if( c == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_read: sock %ld no connection\n",
+                       (long)s ));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "connection_read(%ld): no connection!\n",
                        (long) s, 0, 0 );
-
+#endif
                slapd_remove(s, 0);
 
                ldap_pvt_thread_mutex_unlock( &connections_mutex );
@@ -899,18 +979,28 @@ int connection_read(ber_socket_t s)
        c->c_n_read++;
 
        if( c->c_conn_state == SLAP_C_CLOSING ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_read: conn %d connection closing, ignoring input\n",
+                       c->c_connid));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "connection_read(%d): closing, ignoring input for id=%ld\n",
                        s, c->c_connid, 0 );
-
+#endif
                connection_return( c );
                ldap_pvt_thread_mutex_unlock( &connections_mutex );
                return 0;
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                   "connection_read: conn %d  checking for input.\n", c->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE,
                "connection_read(%d): checking for input on id=%ld\n",
                s, c->c_connid, 0 );
+#endif
 
 #ifdef HAVE_TLS
        if ( c->c_is_tls && c->c_needs_tls_accept ) {
@@ -919,11 +1009,16 @@ int connection_read(ber_socket_t s)
                        struct timeval tv;
                        fd_set rfd;
 
+#ifdef NEW_LOGGING
+                        LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                                   "connection_read: conn %d  TLS accept error, error %d\n",
+                                   c->c_connid, rc ));
+#else
                        Debug( LDAP_DEBUG_TRACE,
                                "connection_read(%d): TLS accept error "
                                "error=%d id=%ld, closing\n",
                                s, rc, c->c_connid );
-
+#endif
                        c->c_needs_tls_accept = 0;
                        /* connections_mutex and c_mutex are locked */
                        connection_closing( c );
@@ -975,11 +1070,16 @@ int connection_read(ber_socket_t s)
                rc = ldap_pvt_sasl_install( c->c_sb,  c->c_sasl_context );
 
                if( rc != LDAP_SUCCESS ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                               "connection_read: conn %d SASL install error %d, closing\n",
+                               c->c_connid, rc ));
+#else
                        Debug( LDAP_DEBUG_TRACE,
                                "connection_read(%d): SASL install error "
                                "error=%d id=%ld, closing\n",
                                s, rc, c->c_connid );
-
+#endif
                        /* connections_mutex and c_mutex are locked */
                        connection_closing( c );
                        connection_close( c );
@@ -1003,10 +1103,15 @@ int connection_read(ber_socket_t s)
        }
 
        if( rc < 0 ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_read: conn %d  input error %d, closing.\n",
+                       c->c_connid, rc ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "connection_read(%d): input error=%d id=%ld, closing.\n",
                        s, rc, c->c_connid );
-
+#endif
                /* connections_mutex and c_mutex are locked */
                connection_closing( c );
                connection_close( c );
@@ -1041,7 +1146,12 @@ connection_input(
 
        if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc())
            == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_input: conn %d  ber_alloc failed.\n", conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "ber_alloc failed\n", 0, 0, 0 );
+#endif
                return -1;
        }
 
@@ -1054,10 +1164,15 @@ connection_input(
 
                ber_sockbuf_ctrl( conn->c_sb, LBER_SB_OPT_GET_FD, &sd );
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                           "connection_input: conn %d  ber_get_next failed, errno %d (%s).\n",
+                           conn->c_connid, err, sock_errstr(err) ));
+#else
                Debug( LDAP_DEBUG_TRACE,
                        "ber_get_next on fd %d failed errno=%d (%s)\n",
                        sd, err, sock_errstr(err) );
-
+#endif
                if ( err != EWOULDBLOCK && err != EAGAIN ) {
                        /* log, close and send error */
                        ber_free( conn->c_currentber, 1 );
@@ -1073,16 +1188,28 @@ connection_input(
 
        if ( (tag = ber_get_int( ber, &msgid )) != LDAP_TAG_MSGID ) {
                /* log, close and send error */
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_input: conn %d  ber_get_int returns 0x%lx.\n",
+                       conn->c_connid, tag ));
+#else
                Debug( LDAP_DEBUG_ANY, "ber_get_int returns 0x%lx\n", tag, 0,
                    0 );
+#endif
                ber_free( ber, 1 );
                return -1;
        }
 
        if ( (tag = ber_peek_tag( ber, &len )) == LBER_ERROR ) {
                /* log, close and send error */
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_input: conn %d  ber_peek_tag returns 0x%lx.\n",
+                       conn->c_connid, tag ));
+#else
                Debug( LDAP_DEBUG_ANY, "ber_peek_tag returns 0x%lx\n", tag, 0,
                    0 );
+#endif
                ber_free( ber, 1 );
 
                return -1;
@@ -1098,7 +1225,13 @@ connection_input(
        if ( conn->c_conn_state == SLAP_C_BINDING
                || conn->c_conn_state == SLAP_C_CLOSING )
        {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                       "connection_input: conn %d  deferring operation\n",
+                       conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY, "deferring operation\n", 0, 0, 0 );
+#endif
                conn->c_n_ops_pending++;
                slap_op_add( &conn->c_pending_ops, op );
 
@@ -1132,9 +1265,15 @@ connection_resched( Connection *conn )
                rc = ldap_pvt_thread_mutex_trylock( &connections_mutex );
 
                if( rc ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                               "connection_resched: conn %d  reaquiring locks.\n",
+                               conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_TRACE,
                                "connection_resched: reaquiring locks conn=%ld sd=%d\n",
                                conn->c_connid, sd, 0 );
+#endif
                        /*
                         * reaquire locks in the right order...
                         * this may allow another thread to close this connection,
@@ -1146,15 +1285,25 @@ connection_resched( Connection *conn )
                }
 
                if( conn->c_conn_state != SLAP_C_CLOSING ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "connection", LDAP_LEVEL_INFO,
+                               "connection_resched: conn %d  closed by other thread.\n",
+                               conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "connection_resched: "
                                "closed by other thread conn=%ld sd=%d\n",
                                conn->c_connid, sd, 0 );
-
+#endif
                } else {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                               "connection_resched: conn %d  attempting closing.\n",
+                               conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "connection_resched: "
                                "attempting closing conn=%ld sd=%d\n",
                                conn->c_connid, sd, 0 );
-
+#endif
                        connection_close( conn );
                }
 
@@ -1218,8 +1367,14 @@ static int connection_op_activate( Connection *conn, Operation *op )
                connection_operation, (void *) arg );
 
        if ( status != 0 ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_op_activate: conn %d  thread pool submit failed.\n",
+                       conn->c_connid ));
+#else
                Debug( LDAP_DEBUG_ANY,
                "ldap_pvt_thread_pool_submit failed (%d)\n", status, 0, 0 );
+#endif
                /* should move op to pending list */
        }
 
@@ -1238,9 +1393,14 @@ int connection_write(ber_socket_t s)
        slapd_clr_write( s, 0);
 
        if( c == NULL ) {
+#ifdef NEW_LOGGING
+            LDAP_LOG(( "connection", LDAP_LEVEL_ERR,
+                       "connection_write: sock %ld  no connection!\n",(long)s));
+#else
                Debug( LDAP_DEBUG_ANY,
                        "connection_write(%ld): no connection!\n",
                        (long) s, 0, 0 );
+#endif
                slapd_remove(s, 0);
                ldap_pvt_thread_mutex_unlock( &connections_mutex );
                return -1;
@@ -1248,10 +1408,15 @@ int connection_write(ber_socket_t s)
 
        c->c_n_write++;
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "connection", LDAP_LEVEL_DETAIL1,
+                   "connection_write conn %d  waking output.\n",
+                   c->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE,
                "connection_write(%d): waking output for id=%ld\n",
                s, c->c_connid, 0 );
-
+#endif
        ldap_pvt_thread_cond_signal( &c->c_write_cv );
 
        if ( ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_NEEDS_READ, NULL ) )
index e99eeed1e5909301c8c437bcf9ceadcc7be78ef2..5dc4b6cd468fc05e335a5bd04dcfc775cc66cd34 100644 (file)
@@ -55,8 +55,12 @@ int get_ctrls(
                goto return_results;
        }
 
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_ENTRY,
+                   "get_ctrls: conn %d\n", conn->c_connid ));
+#else
        Debug( LDAP_DEBUG_TRACE, "=> get_ctrls\n", 0, 0, 0 );
-
+#endif
        if( op->o_protocol < LDAP_VERSION3 ) {
                rc = SLAPD_DISCONNECT;
                errmsg = "controls require LDAPv3";
@@ -116,8 +120,14 @@ int get_ctrls(
                tag = ber_scanf( ber, "{a" /*}*/, &tctrl->ldctl_oid );
 
                if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                    LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                               "get_ctrls: conn %d  get OID failed.\n",
+                               conn->c_connid ));
+#else
                        Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get oid failed.\n",
                                0, 0, 0 );
+#endif
                        *ctrls = NULL;
                        ldap_controls_free( tctrls );
                        rc = SLAPD_DISCONNECT;
@@ -132,8 +142,14 @@ int get_ctrls(
                        tag = ber_scanf( ber, "b", &crit );
 
                        if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                       "get_ctrls: conn %d  get crit failed.\n",
+                                       conn->c_connid ));
+#else
                                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get crit failed.\n",
                                        0, 0, 0 );
+#endif
                                *ctrls = NULL;
                                ldap_controls_free( tctrls );
                                rc = SLAPD_DISCONNECT;
@@ -145,17 +161,28 @@ int get_ctrls(
                        tag = ber_peek_tag( ber, &len );
                }
 
+#ifdef NEW_LOGGING
+                LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                           "get_ctrls: conn %d oid=\"%s\" (%scritical)\n",
+                           conn->c_connid, tctrl->ldctl_oid,
+                           tctrl->ldctl_iscritical ? "" : "non" ));
+#else
                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: oid=\"%s\" (%scritical)\n",
                        tctrl->ldctl_oid, 
                        tctrl->ldctl_iscritical ? "" : "non",
                        0 );
-
+#endif
                if( tag == LBER_OCTETSTRING ) {
                        tag = ber_scanf( ber, "o", &tctrl->ldctl_value );
 
                        if( tag == LBER_ERROR ) {
+#ifdef NEW_LOGGING
+                            LDAP_LOG(( "operation", LDAP_LEVEL_INFO,
+                                       "get_ctrls: conn %d  get value failed.\n", conn->c_connid ));
+#else
                                Debug( LDAP_DEBUG_TRACE, "=> get_ctrls: get value failed.\n",
                                        0, 0, 0 );
+#endif
                                *ctrls = NULL;
                                ldap_controls_free( tctrls );
                                rc = SLAPD_DISCONNECT;
@@ -176,9 +203,14 @@ int get_ctrls(
        }
 
 return_results:
+#ifdef NEW_LOGGING
+        LDAP_LOG(( "operation", LDAP_LEVEL_RESULTS,
+                   "get_ctrls: conn %s  %d %d %s\n",
+                   conn->c_connid, nctrls, rc, errmsg ? errmsg : "" ));
+#else
        Debug( LDAP_DEBUG_TRACE, "<= get_ctrls: %d %d %s\n",
                nctrls, rc, errmsg ? errmsg : "");
-
+#endif
        if( sendres && rc != LDAP_SUCCESS ) {
                if( rc == SLAPD_DISCONNECT ) {
                        send_ldap_disconnect( conn, op, rc, errmsg );