]> git.sur5r.net Git - openldap/commitdiff
mostly new logging
authorKurt Zeilenga <kurt@openldap.org>
Sun, 28 Jul 2002 21:10:45 +0000 (21:10 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 28 Jul 2002 21:10:45 +0000 (21:10 +0000)
32 files changed:
libraries/libldap/abandon.c
libraries/libldap/add.c
libraries/libldap/bind.c
libraries/libldap/cache.c
libraries/libldap/compare.c
libraries/libldap/cyrus.c
libraries/libldap/delete.c
libraries/libldap/dntest.c
libraries/libldap/error.c
libraries/libldap/extended.c
libraries/libldap/filter.c
libraries/libldap/getattr.c
libraries/libldap/getdn.c
libraries/libldap/getfilter.c
libraries/libldap/getvalues.c
libraries/libldap/init.c
libraries/libldap/kbind.c
libraries/libldap/modify.c
libraries/libldap/modrdn.c
libraries/libldap/open.c
libraries/libldap/options.c [new file with mode: 0644]
libraries/libldap/os-ip.c
libraries/libldap/os-local.c
libraries/libldap/request.c
libraries/libldap/result.c
libraries/libldap/sasl.c
libraries/libldap/sbind.c
libraries/libldap/schema.c
libraries/libldap/search.c
libraries/libldap/tls.c
libraries/libldap/unbind.c
libraries/libldap/url.c

index 70c2d97e732879709e9beae901f9bc3bed22907a..a88a5865b5a89ab8813b2c49ababf82bd4954ee3 100644 (file)
@@ -58,7 +58,7 @@ ldap_abandon_ext(
 {
        int rc;
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "abandon", LDAP_LEVEL_ARGS, "ldap_abandon_ext %d\n", msgid ));
+       LDAP_LOG ( OPERATION, ARGS, "ldap_abandon_ext %d\n", msgid, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_abandon_ext %d\n", msgid, 0, 0 );
 #endif
@@ -86,7 +86,7 @@ int
 ldap_abandon( LDAP *ld, int msgid )
 {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "abandon", LDAP_LEVEL_ARGS, "ldap_abandon %d\n", msgid ));
+       LDAP_LOG ( OPERATION, ARGS, "ldap_abandon %d\n", msgid, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
 #endif
@@ -110,8 +110,7 @@ do_abandon(
        LDAPRequest     *lr;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "abandon", LDAP_LEVEL_ARGS, "do_abandon %d, msgid %d\n", 
-               origid, msgid ));
+       LDAP_LOG ( OPERATION, ARGS, "do_abandon %d, msgid %d\n", origid, msgid, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "do_abandon origid %d, msgid %d\n",
                origid, msgid, 0 );
index 1ce57eba7f6f95d4fa09a3796ea268aa5f8febf1..20a987e97734bb7d3725a3f8332721be894f051a 100644 (file)
@@ -100,7 +100,7 @@ ldap_add_ext(
        int             i, rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "add", LDAP_LEVEL_ENTRY, "ldap_add_ext\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_add_ext\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_add_ext\n", 0, 0, 0 );
 #endif
index 076bd179768d085e85a416848986c6657c6d7c46..4040da1804eb28f9263f31a9d2b68bff17eb3e4e 100644 (file)
@@ -42,7 +42,7 @@
 #include <ac/time.h>
 
 #include "ldap-int.h"
-
+#include "ldap_log.h"
 
 /*
  * ldap_bind - bind to the ldap server (and X.500).  The dn and password
@@ -61,7 +61,7 @@ int
 ldap_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd, int authmethod )
 {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "bind", LDAP_LEVEL_ENTRY, "ldap_bind\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_bind\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_bind\n", 0, 0, 0 );
 #endif
@@ -110,7 +110,7 @@ ldap_bind_s(
        int authmethod )
 {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "bind", LDAP_LEVEL_ENTRY, "ldap_bind_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_bind_s\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 );
 #endif
index 83e6e7953cbe9b0ff8da07f23f52149eb1999bf9..f071ab6255e02fe9ad97db17f6d3923bddaf5dcf 100644 (file)
@@ -118,7 +118,7 @@ ldap_flush_cache( LDAP *ld )
        assert( LDAP_VALID( ld ) );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_flush_cache\n" ));
+       LDAP_LOG ( CACHE, ENTRY, "ldap_flush_cache\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
 #endif
@@ -154,9 +154,9 @@ ldap_uncache_request( LDAP *ld, int msgid )
 
 #ifndef LDAP_NOCACHE
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ARGS, 
-               "ldap_uncache_request %d ld_cache %lx\n",
-               msgid, (long) ld->ld_cache ));
+
+       LDAP_LOG ( CACHE, ARGS, "ldap_uncache_request %d ld_cache %lx\n",
+               msgid, (long) ld->ld_cache, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %lx\n",
            msgid, (long) ld->ld_cache, 0 );
@@ -176,9 +176,9 @@ ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn )
 
 #ifndef LDAP_NOCACHE
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ARGS, 
-               "ldap_uncache_entry %s ld_cache %lx\n",
-               dn, (long) ld->ld_cache ));
+
+       LDAP_LOG ( CACHE, ARGS, "ldap_uncache_entry %s ld_cache %lx\n",
+               dn, (long) ld->ld_cache, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
            dn, (long) ld->ld_cache, 0 );
@@ -200,9 +200,10 @@ uncache_entry_or_req( LDAP *ld,
        LDAPMessage     *m, *prev, *next;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ARGS, 
+
+       LDAP_LOG ( CACHE, ARGS, 
                "uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
-               dn, (long) msgid, (long) ld->ld_cache ));
+               dn, (long) msgid, (long) ld->ld_cache );
 #else
        Debug( LDAP_DEBUG_TRACE,
            "ldap_uncache_entry_or_req  dn %s  msgid %ld  ld_cache %lx\n",
@@ -266,7 +267,7 @@ ldap_add_request_to_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
        assert( LDAP_VALID( ld ) );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_add_request_to_cache\n" ));
+       LDAP_LOG ( CACHE, ENTRY, "ldap_add_request_to_cache\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
 #endif
@@ -318,9 +319,10 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
        assert( result != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ARGS, 
+
+       LDAP_LOG ( CACHE, ARGS, 
                "ldap_add_result_to_cache: id %ld, type %ld\n",
-               (long) result->lm_msgid, (long) result->lm_msgtype ));
+               (long) result->lm_msgid, (long) result->lm_msgtype, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %ld, type %ld\n", 
                (long) result->lm_msgid, (long) result->lm_msgtype, 0 );
@@ -329,8 +331,8 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
        if ( ld->ld_cache == NULL ||
            ( ld->ld_cache->lc_enabled == 0 )) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-               "ldap_add_result_to_cache: cache disabled\n" ));
+               LDAP_LOG ( CACHE, DETAIL1, 
+                       "ldap_add_result_to_cache: cache disabled\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
 #endif
@@ -345,9 +347,9 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
                 * only cache search and compare operations
                 */
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-               "ldap_add_result_to_cache: "
-               "only caching search & compare operations\n" ));
+               LDAP_LOG ( CACHE, DETAIL1, 
+                       "ldap_add_result_to_cache: only caching search & "
+                       "compare operations\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                    "artc: only caching search & compare operations\n", 0, 0, 0 );
@@ -376,9 +378,9 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
                        new->lm_chain = NULL;
                        m->lm_chain = new;
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
+                       LDAP_LOG ( CACHE, RESULTS, 
                                "ldap_add_result_to_cache: "
-                               "result added to cache request chain\n" ));
+                               "result added to cache request chain\n", 0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                            "artc: result added to cache request chain\n",
@@ -418,9 +420,9 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
 
                        if ( !keep ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
+                               LDAP_LOG ( CACHE, RESULTS, 
                                        "ldap_add_result_to_cache: "
-                                       "not caching result with error\n" ));
+                                       "not caching result with error\n", 0, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                    "artc: not caching result with error %d\n",
@@ -436,9 +438,9 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
                                ld->ld_cache->lc_memused += msg_size( req );
                                check_cache_memused( ld->ld_cache );
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
+                               LDAP_LOG ( CACHE, RESULTS, 
                                        "ldap_add_result_to_cache: "
-                                       "cached result with error\n" ));
+                                       "cached result with error\n", 0, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                    "artc: cached result with error %d\n",
@@ -448,9 +450,8 @@ ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
                }
        } else {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
-                       "ldap_add_result_to_cache: "
-                       "msgid not in request list\n" ));
+               LDAP_LOG ( CACHE, RESULTS, 
+                       "ldap_add_result_to_cache: msgid not in request list\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "artc: msgid not in request list\n",
                    0, 0, 0 );
@@ -481,7 +482,7 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
        assert( request != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_ENTRY, "ldap_check_cache\n" ));
+       LDAP_LOG ( CACHE, ENTRY, "ldap_check_cache\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
 #endif
@@ -503,9 +504,9 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
        hash = cache_hash( &reqber );
        for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
+               LDAP_LOG ( CACHE, DETAIL1, 
                        "ldap_check_cache: examining id %ld, type %ld\n",
-                       (long) m->lm_msgid, (long) m->lm_msgtype ));
+                       (long) m->lm_msgid, (long) m->lm_msgtype, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,"cc: examining id %ld,type %ld\n",
                    (long) m->lm_msgid, (long) m->lm_msgtype, 0 );
@@ -519,9 +520,8 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
                                prev->lm_next = next;
                        }
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-                               "ldap_check_cache: expired id %ld\n",
-                               (long) m->lm_msgid ));
+                       LDAP_LOG ( CACHE, DETAIL1, "ldap_check_cache: expired id %ld\n",
+                               (long) m->lm_msgid, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "cc: expired id %d\n",
                            m->lm_msgid, 0, 0 );
@@ -562,9 +562,8 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
                }
                prev = new;
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-                       "ldap_check_cache: added type %ld\n",
-                       (long) m->lm_msgtype ));
+               LDAP_LOG ( CACHE, DETAIL1, "ldap_check_cache: added type %ld\n",
+                       (long) m->lm_msgtype, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "cc: added type %ld\n",
                    (long) new->lm_msgtype, 0, 0 );
@@ -572,8 +571,8 @@ ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
-               "ldap_check_cache: result returned from cache\n" ));
+       LDAP_LOG ( CACHE, RESULTS, 
+               "ldap_check_cache: result returned from cache\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
 #endif
@@ -603,9 +602,8 @@ cache_hash( BerElement *ber )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_RESULTS, 
-               "cache_hash: len is %ld, returning %ld\n",
-                len, len % LDAP_CACHE_BUCKETS ));
+       LDAP_LOG ( CACHE, RESULTS, "cache_hash: len is %ld, returning %ld\n",
+               len, len % LDAP_CACHE_BUCKETS, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "cache_hash: len is %ld, returning %ld\n",
            len, len % LDAP_CACHE_BUCKETS, 0 );
@@ -760,9 +758,9 @@ check_cache_memused( LDAPCache *lc )
        LDAPMessage     *m, *prev, *next;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
+       LDAP_LOG ( CACHE, DETAIL1, 
                "check_cache_memused: %ld bytes in use (%ld max)\n",
-                lc->lc_memused, lc->lc_maxmem ));
+               lc->lc_memused, lc->lc_maxmem, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "check_cache_memused: %ld bytes in use (%ld max)\n",
            lc->lc_memused, lc->lc_maxmem, 0 );
@@ -789,9 +787,8 @@ check_cache_memused( LDAPCache *lc )
                                        }
                                        lc->lc_memused -= msg_size( m );
 #ifdef NEW_LOGGING
-                                       LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-                                               "check_cache_memused: removed %ld\n",
-                                               m->lm_msgid ));
+                                       LDAP_LOG ( CACHE, DETAIL1, 
+                                               "check_cache_memused: removed %ld\n", m->lm_msgid,0,0 );
 #else
                                        Debug( LDAP_DEBUG_TRACE,
                                            "ccm: removed %d\n",
@@ -807,9 +804,9 @@ check_cache_memused( LDAPCache *lc )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cache", LDAP_LEVEL_DETAIL1, 
-               "check_cache_memused: reduced usage to %ld bytes\n",
-               lc->lc_memused ));
+       LDAP_LOG ( CACHE, DETAIL1, 
+               "check_cache_memused: reduced usage to %ld bytes\n", 
+               lc->lc_memused, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ccm: reduced usage to %ld bytes\n",
            lc->lc_memused, 0, 0 );
index 4af59d01b8d15842a6a5f44db0244028d1a04c66..bb13bcc11f511a673d8a43b51df26c8937b04798 100644 (file)
@@ -29,6 +29,7 @@
 #include <ac/time.h>
 
 #include "ldap-int.h"
+#include "ldap_log.h"
 
 /*
  * ldap_compare_ext - perform an ldap extended compare operation.  The dn
@@ -55,7 +56,7 @@ ldap_compare_ext(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "compare", LDAP_LEVEL_ENTRY, "ldap_compare\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_compare\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
 #endif
index f215b752e16616de51068a4d564b663cc2f3564a..5310903c0ea570f59d59c2395ab7139e8bf6399f 100644 (file)
@@ -361,7 +361,7 @@ Sockbuf_IO ldap_pvt_sockbuf_io_sasl = {
 int ldap_pvt_sasl_install( Sockbuf *sb, void *ctx_arg )
 {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cyrus", LDAP_LEVEL_ENTRY, "ldap_pvt_sasl_install\n" ));
+       LDAP_LOG ( TRANSPORT, ENTRY, "ldap_pvt_sasl_install\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_install\n",
                0, 0, 0 );
@@ -457,8 +457,8 @@ ldap_int_sasl_open(
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cyrus", LDAP_LEVEL_DETAIL1
-               "ldap_int_sasl_open: host=%s\n", host ));
+       LDAP_LOG ( TRANSPORT, DETAIL1, "ldap_int_sasl_open: host=%s\n"
+               host, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_int_sasl_open: host=%s\n",
                host, 0, 0 );
@@ -479,8 +479,8 @@ ldap_int_sasl_open(
                        (void *) &extprops );
 #endif
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "cyrus", LDAP_LEVEL_DETAIL1, 
-                       "ldap_int_sasl_open: ssf=%ld\n", (long) ssf ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                       "ldap_int_sasl_open: ssf=%ld\n", (long) ssf, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "ldap_int_sasl_open: ssf=%ld\n",
                        (long) ssf, 0, 0 );
@@ -525,8 +525,8 @@ ldap_int_sasl_bind(
        ber_socket_t            sd;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "cyrus", LDAP_LEVEL_ARGS
-                       "ldap_int_sasl_bind: %s\n", mechs ? mechs : "<null>" ));
+       LDAP_LOG ( TRANSPORT, ARGS, "ldap_int_sasl_bind: %s\n"
+               mechs ? mechs : "<null>", 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_int_sasl_bind: %s\n",
                mechs ? mechs : "<null>", 0, 0 );
@@ -637,9 +637,9 @@ ldap_int_sasl_bind(
                        if( scred && scred->bv_len ) {
                                /* and server provided us with data? */
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "cyrus", LDAP_LEVEL_DETAIL1, 
+                               LDAP_LOG ( TRANSPORT, DETAIL1, 
                                        "ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n", 
-                                       rc, saslrc, scred->bv_len ));
+                                       rc, saslrc, scred->bv_len );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
@@ -655,9 +655,9 @@ ldap_int_sasl_bind(
                        if( scred && scred->bv_len ) {
                                /* but server provided us with data! */
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "cyrus", LDAP_LEVEL_DETAIL1, 
+                               LDAP_LOG ( TRANSPORT, DETAIL1, 
                                        "ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n", 
-                                       rc, saslrc, scred->bv_len ));
+                                       rc, saslrc, scred->bv_len );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
@@ -678,8 +678,8 @@ ldap_int_sasl_bind(
                                &credlen );
 
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "cyrus", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_int_sasl_bind: sasl_client_step: %d\n", saslrc ));
+                               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                                       "ldap_int_sasl_bind: sasl_client_step: %d\n", saslrc,0,0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "sasl_client_step: %d\n",
                                saslrc, 0, 0 );
index c91e02e565c61c186ec99670ac8abea154c39a80..e930fc579bae1557744c44f064ab3f167e2d567e 100644 (file)
@@ -49,7 +49,7 @@ ldap_delete_ext(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "delete", LDAP_LEVEL_ENTRY, "ldap_delete_ext\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_delete_ext\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_delete_ext\n", 0, 0, 0 );
 #endif
@@ -139,7 +139,7 @@ ldap_delete( LDAP *ld, LDAP_CONST char *dn )
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "delete", LDAP_LEVEL_ENTRY, "ldap_delete\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_delete\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
 #endif
index 72d3c52febb82f4e73f4c1564564ccfcef8a84eb..97cc7278806c2d7f98e40c1dc41e74efe5c63359 100644 (file)
  */
 #include "portable.h"
 
+#include <stdio.h>
+
 #include <ac/stdlib.h>
 #include <ac/string.h>
 #include <ac/unistd.h>
 
-#include <stdio.h>
-
 #include <ldap.h>
 
 #include "ldap-int.h"
index 3569887747de5e16b2c0d3ecf7f2d87736a1722f..45f9eec86e4a8542766b7064a11d6c324ea5ce90 100644 (file)
@@ -30,13 +30,13 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_COMPARE_FALSE,                    "Compare False" },
        {LDAP_COMPARE_TRUE,                     "Compare True" },
        {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Authentication method not supported" },
-       {LDAP_STRONG_AUTH_REQUIRED,     "Strong authentication required" },
+       {LDAP_STRONG_AUTH_REQUIRED,     "Strong(er) authentication required" },
        {LDAP_PARTIAL_RESULTS,                  "Partial results and referral received" },
 
        {LDAP_REFERRAL,                                 "Referral"},
        {LDAP_ADMINLIMIT_EXCEEDED,              "Administrative limit exceeded"},
        {LDAP_UNAVAILABLE_CRITICAL_EXTENSION,
-                                                                       "Criticial extension is unavailable"},
+                                                                       "Critical extension is unavailable"},
        {LDAP_CONFIDENTIALITY_REQUIRED, "Confidentiality required"},
        {LDAP_SASL_BIND_IN_PROGRESS,    "SASL bind in progress"},
 
@@ -56,21 +56,21 @@ static struct ldaperror ldap_builtin_errlist[] = {
        {LDAP_INAPPROPRIATE_AUTH,               "Inappropriate authentication" },
        {LDAP_INVALID_CREDENTIALS,              "Invalid credentials" },
        {LDAP_INSUFFICIENT_ACCESS,              "Insufficient access" },
-       {LDAP_BUSY,                                     "DSA is busy" },
-       {LDAP_UNAVAILABLE,                              "DSA is unavailable" },
-       {LDAP_UNWILLING_TO_PERFORM,     "DSA is unwilling to perform" },
+       {LDAP_BUSY,                                     "Server is busy" },
+       {LDAP_UNAVAILABLE,                              "Server is unavailable" },
+       {LDAP_UNWILLING_TO_PERFORM,     "Server is unwilling to perform" },
        {LDAP_LOOP_DETECT,                              "Loop detected" },
 
        {LDAP_NAMING_VIOLATION,                 "Naming violation" },
        {LDAP_OBJECT_CLASS_VIOLATION,   "Object class violation" },
-       {LDAP_NOT_ALLOWED_ON_NONLEAF,   "Operation not allowed on nonleaf" },
+       {LDAP_NOT_ALLOWED_ON_NONLEAF,   "Operation not allowed on non-leaf" },
        {LDAP_NOT_ALLOWED_ON_RDN,               "Operation not allowed on RDN" },
        {LDAP_ALREADY_EXISTS,                   "Already exists" },
        {LDAP_NO_OBJECT_CLASS_MODS,     "Cannot modify object class" },
        {LDAP_RESULTS_TOO_LARGE,                "Results too large" },
        {LDAP_AFFECTS_MULTIPLE_DSAS,    "Operation affects multiple DSAs" },
 
-       {LDAP_OTHER,                                    "Unknown error" },
+       {LDAP_OTHER,                                    "Internal (implementation specific) error" },
 
        /* API ResultCodes */
        {LDAP_SERVER_DOWN,                              "Can't contact LDAP server" },
@@ -147,7 +147,7 @@ ldap_err2string( int err )
        const struct ldaperror *e;
        
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "error", LDAP_LEVEL_ENTRY, "ldap_err2string\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_err2string\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_err2string\n", 0, 0, 0 );
 #endif
@@ -163,7 +163,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str )
 {
        const struct ldaperror *e;
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "error", LDAP_LEVEL_ENTRY, "ldap_perror\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_perror\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );
 #endif
@@ -243,7 +243,7 @@ ldap_parse_result(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "error", LDAP_LEVEL_ENTRY, "ldap_parse_result\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_result\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_parse_result\n", 0, 0, 0 );
 #endif
index b0a7ed691a44329f38baf7c434b9db12d00fd5fc..3789720d880d82b92df1cb470adef44aaae2341c 100644 (file)
@@ -30,6 +30,7 @@
 #include <ac/time.h>
 
 #include "ldap-int.h"
+#include "ldap_log.h"
 
 int
 ldap_extended_operation(
@@ -44,7 +45,7 @@ ldap_extended_operation(
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "extended", LDAP_LEVEL_ENTRY, "ldap_extended_operation\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_extended_operation\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation\n", 0, 0, 0 );
 #endif
@@ -117,7 +118,7 @@ ldap_extended_operation_s(
     LDAPMessage *res;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "extended", LDAP_LEVEL_ENTRY, "ldap_extended_operation_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_extended_operation_s\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation_s\n", 0, 0, 0 );
 #endif
@@ -173,7 +174,7 @@ ldap_parse_extended_result (
        assert( res != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "extended", LDAP_LEVEL_ENTRY, "ldap_parse_extended_result\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_extended_result\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_parse_extended_result\n", 0, 0, 0 );
 #endif
@@ -300,8 +301,7 @@ ldap_parse_extended_partial (
        assert( res != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "extended", LDAP_LEVEL_ENTRY, 
-               "ldap_parse_extended_partial\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_extended_partial\n", 0,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_parse_extended_partial\n", 0, 0, 0 );
 #endif
index 93a45cd75aa9f6507cb010a07152e314ffb83b0e..259c9a459089dba1a482147aa463f1c82ea06ab7 100644 (file)
@@ -357,8 +357,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "ldap_pvt_put_filter: \"%s\"\n",
-               str_in ));
+       LDAP_LOG ( FILTER, ARGS, "ldap_pvt_put_filter: \"%s\"\n", str_in,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_filter: \"%s\"\n", str_in, 0, 0 );
 #endif
@@ -380,8 +379,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
                        switch ( *str ) {
                        case '&':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: AND\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: AND\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: AND\n",
                                    0, 0, 0 );
@@ -399,8 +397,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        case '|':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: OR\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: OR\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: OR\n",
                                    0, 0, 0 );
@@ -418,8 +415,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        case '!':
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: NOT\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: NOT\n", 0,0,0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: NOT\n",
                                    0, 0, 0 );
@@ -437,8 +433,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                        default:
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_pvt_put_filter: simple\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: simple\n", 0,0,0);
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_filter: simple\n",
                                    0, 0, 0 );
@@ -488,8 +483,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                case /*'('*/ ')':
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: end\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: end\n", 0,0,0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: end\n",
                                0, 0, 0 );
@@ -508,8 +502,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
 
                default:        /* assume it's a simple type=value filter */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: default\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: default\n", 0,0,0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: default\n",
                                0, 0, 0 );
@@ -542,8 +535,7 @@ put_filter_list( BerElement *ber, char *str, ber_tag_t tag )
        char    save;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_filter_list \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_filter_list \"%s\"\n", str,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_filter_list \"%s\"\n",
                str, 0, 0 );
@@ -587,8 +579,7 @@ put_simple_filter(
        int             rc = -1;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_simple_filter: \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_simple_filter: \"%s\"\n", str,0,0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_simple_filter: \"%s\"\n",
                str, 0, 0 );
@@ -759,8 +750,7 @@ put_substring_filter( BerElement *ber, char *type, char *val )
        ber_tag_t       ftype = LDAP_FILTER_SUBSTRINGS;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-                               "put_substring_filter \"%s=%s\"\n", type, val ));
+       LDAP_LOG ( FILTER, ARGS, "put_substring_filter \"%s=%s\"\n", type, val, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_substring_filter \"%s=%s\"\n",
                type, val, 0 );
@@ -847,8 +837,8 @@ put_vrFilter( BerElement *ber, const char *str_in )
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, "put_vrFilter: \"%s\"\n",
-               str_in ));
+       LDAP_LOG ( FILTER, ARGS, "ldap_pvt_put_vrFilter: \"%s\"\n", 
+               str_in, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_vrFilter: \"%s\"\n", str_in, 0, 0 );
 #endif
@@ -892,8 +882,8 @@ put_vrFilter( BerElement *ber, const char *str_in )
 
                        default:
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                                       "put_vrFilter: simple\n" ));
+                               LDAP_LOG ( FILTER, DETAIL1, 
+                                       "put_vrFilter: simple\n", 0, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "put_vrFilter: simple\n",
                                    0, 0, 0 );
@@ -943,8 +933,7 @@ put_vrFilter( BerElement *ber, const char *str_in )
 
                case /*'('*/ ')':
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1, 
-                               "ldap_pvt_put_filter: end\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: end\n", 0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: end\n",
                                0, 0, 0 );
@@ -963,8 +952,8 @@ put_vrFilter( BerElement *ber, const char *str_in )
 
                default:        /* assume it's a simple type=value filter */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "filter", LDAP_LEVEL_DETAIL1
-                               "ldap_pvt_put_filter: default\n" ));
+                       LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: default\n"
+                               0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "put_filter: default\n",
                                0, 0, 0 );
@@ -1011,8 +1000,7 @@ put_vrFilter_list( BerElement *ber, char *str )
        char    save;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-               "put_vrFilter_list \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_vrFilter_list \"%s\"\n", str, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_vrFilter_list \"%s\"\n",
                str, 0, 0 );
@@ -1050,8 +1038,7 @@ put_simple_vrFilter(
        int             rc = -1;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "filter", LDAP_LEVEL_ARGS, 
-               "put_simple_vrFilter: \"%s\"\n", str ));
+       LDAP_LOG ( FILTER, ARGS, "put_simple_vrFilter: \"%s\"\n", str, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "put_simple_vrFilter: \"%s\"\n",
                str, 0, 0 );
index e5cd6e628d910edf1f09734f212d394b6f7f9bbc..91e37b28351ed993818b83e492a46d00d27d798d 100644 (file)
@@ -31,7 +31,7 @@ ldap_first_attribute( LDAP *ld, LDAPMessage *entry, BerElement **berout )
        BerElement *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getattr", LDAP_LEVEL_ENTRY, "ldap_first_attribute\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_first_attribute\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_first_attribute\n", 0, 0, 0 );
 #endif
@@ -97,7 +97,7 @@ ldap_next_attribute( LDAP *ld, LDAPMessage *entry, BerElement *ber )
        char *attr;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getattr", LDAP_LEVEL_ENTRY, "ldap_next_attribute\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_next_attribute\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_next_attribute\n", 0, 0, 0 );
 #endif
index 43c1b4470b54c571f02cf1b278a67bda52b452e2..781dca07afe6450849247111e1a12ed1e7caf525 100644 (file)
@@ -85,7 +85,7 @@ ldap_get_dn( LDAP *ld, LDAPMessage *entry )
        BerElement      tmp;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_get_dn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_get_dn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_get_dn\n", 0, 0, 0 );
 #endif
@@ -112,7 +112,7 @@ ldap_dn2ufn( LDAP_CONST char *dn )
        char    *out = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_dn2ufn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_dn2ufn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_dn2ufn\n", 0, 0, 0 );
 #endif
@@ -135,7 +135,7 @@ ldap_explode_dn( LDAP_CONST char *dn, int notypes )
        unsigned flag = notypes ? LDAP_DN_FORMAT_UFN : LDAP_DN_FORMAT_LDAPV3;
        
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_explode_dn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_explode_dn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_explode_dn\n", 0, 0, 0 );
 #endif
@@ -179,7 +179,7 @@ ldap_explode_rdn( LDAP_CONST char *rdn, int notypes )
        int             iAVA;
        
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_explode_rdn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_explode_rdn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_explode_rdn\n", 0, 0, 0 );
 #endif
@@ -264,7 +264,7 @@ ldap_dn2dcedn( LDAP_CONST char *dn )
        char    *out = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_dn2dcedn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_dn2dcedn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_dn2dcedn\n", 0, 0, 0 );
 #endif
@@ -281,7 +281,7 @@ ldap_dcedn2dn( LDAP_CONST char *dce )
        char    *out = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_dcedn2dn\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_dcedn2dn\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_dcedn2dn\n", 0, 0, 0 );
 #endif
@@ -297,7 +297,7 @@ ldap_dn2ad_canonical( LDAP_CONST char *dn )
        char    *out = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_dn2ad_canonical\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_dn2ad_canonical\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_dn2ad_canonical\n", 0, 0, 0 );
 #endif
@@ -333,7 +333,7 @@ ldap_dn_normalize( LDAP_CONST char *dnin,
        LDAPDN  *tmpDN = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ENTRY, "ldap_dn_normalize\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_dn_normalize\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_dn_normalize\n", 0, 0, 0 );
 #endif
@@ -660,9 +660,8 @@ ldap_bv2dn( struct berval *bv, LDAPDN **dn, unsigned flags )
        assert( dn );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ARGS, "ldap_bv2dn(%s,%u)\n%s", 
-               str, flags, "" ));
-#elif 0
+       LDAP_LOG ( OPERATION, ARGS, "ldap_bv2dn(%s,%u)\n%s", str, flags, "" );
+#else
        Debug( LDAP_DEBUG_TRACE, "=> ldap_bv2dn(%s,%u)\n%s", str, flags, "" );
 #endif
 
@@ -837,9 +836,9 @@ return_result:;
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_RESULTS, "<= ldap_bv2dn(%s,%u)=%d\n", 
-               str, flags, rc ));
-#elif 0
+       LDAP_LOG ( OPERATION, RESULTS, "<= ldap_bv2dn(%s,%u)=%d\n", 
+               str, flags, rc );
+#else
        Debug( LDAP_DEBUG_TRACE, "<= ldap_bv2dn(%s,%u)=%d\n", str, flags, rc );
 #endif
        *dn = newDN;
@@ -2967,9 +2966,9 @@ int ldap_dn2bv( LDAPDN *dn, struct berval *bv, unsigned flags )
        bv->bv_val = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_ARGS, "=> ldap_dn2bv(%u)\n%s%s", 
-               flags, "", "" ));
-#elif 0
+       LDAP_LOG ( OPERATION, ARGS, "=> ldap_dn2bv(%u)\n%s%s", 
+               flags, "", "" );
+#else
        Debug( LDAP_DEBUG_TRACE, "=> ldap_dn2bv(%u)\n%s%s", flags, "", "" );
 #endif
 
@@ -3279,9 +3278,9 @@ int ldap_dn2bv( LDAPDN *dn, struct berval *bv, unsigned flags )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getdn", LDAP_LEVEL_RESULTS, "<= ldap_dn2bv(%s,%u)=%d\n", 
-               bv->bv_val, flags, rc ));
-#elif 0
+       LDAP_LOG ( OPERATION, RESULTS, "<= ldap_dn2bv(%s,%u)=%d\n", 
+               bv->bv_val, flags, rc );
+#else
        Debug( LDAP_DEBUG_TRACE, "<= ldap_dn2bv(%s,%u)=%d\n",
                bv->bv_val, flags, rc );
 #endif
index d6f62f325504289bc915c5fe5d3ad9e3d0cbf84e..d4d0d4452a045613144a41736b800b4dba5dd1d9 100644 (file)
@@ -79,9 +79,9 @@ ldap_init_getfilter_buf( char *buf, ber_len_t buflen )
                regerror(rc, &re, error, sizeof(error));
                ldap_getfilter_free( lfdp );
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "getfilter", LDAP_LEVEL_ERR, 
-                       "ldap_init_get_filter_buf: bad regular expression %s, %s\n",
-                       nextflp->lfl_pattern, error ));
+               LDAP_LOG ( FILTER, ERR, 
+                       "ldap_init_get_filter_buf: bad regular expression %s, %s\n", 
+                       nextflp->lfl_pattern, error, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "ldap_init_get_filter_buf: "
                        "bad regular expression %s, %s\n",
index bbf16d8c411c3e6b8981527cd216ea12517b8f56..34ee28da563a40a9706cf1aca713aaea49f2dd3d 100644 (file)
@@ -37,7 +37,7 @@ ldap_get_values( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
        assert( target != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getvalues", LDAP_LEVEL_ENTRY, "ldap_get_values\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_get_values\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_get_values\n", 0, 0, 0 );
 #endif
@@ -98,7 +98,7 @@ ldap_get_values_len( LDAP *ld, LDAPMessage *entry, LDAP_CONST char *target )
        assert( target != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "getvalues", LDAP_LEVEL_ENTRY, "ldap_get_values_len\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_get_values_len\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_get_values_len\n", 0, 0, 0 );
 #endif
index c6b68759823304508494be73f768def571f82827..96e7b8f3dc9f67be7a18bb108a3c23902bb831e0 100644 (file)
@@ -116,8 +116,8 @@ static void openldap_ldap_init_w_conf(
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
-               "openldap_init_w_conf: trying %s\n", file ));
+       LDAP_LOG ( CONFIG, DETAIL1, 
+               "openldap_init_w_conf: trying %s\n", file, 0, 0 );
 #else
        Debug(LDAP_DEBUG_TRACE, "ldap_init: trying %s\n", file, 0, 0);
 #endif
@@ -129,8 +129,7 @@ static void openldap_ldap_init_w_conf(
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
-               "openldap_init_w_conf: using %s\n", file ));
+       LDAP_LOG ( CONFIG, DETAIL1, "openldap_init_w_conf: using %s\n", file, 0, 0 );
 #else
        Debug(LDAP_DEBUG_TRACE, "ldap_init: using %s\n", file, 0, 0);
 #endif
@@ -262,17 +261,17 @@ static void openldap_ldap_init_w_userconf(const char *file)
 
        if (home != NULL) {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "init", LDAP_LEVEL_ARGS, 
-               "openldap_init_w_userconf: HOME env is %s\n", home ));
+       LDAP_LOG ( CONFIG, ARGS, 
+               "openldap_init_w_userconf: HOME env is %s\n", home, 0, 0 );
 #else
                Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is %s\n",
                      home, 0, 0);
 #endif
-               path = LDAP_MALLOC(strlen(home) + strlen(file) + 3);
+               path = LDAP_MALLOC(strlen(home) + strlen(file) + sizeof( LDAP_DIRSEP "."));
        } else {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "init", LDAP_LEVEL_ARGS, 
-               "openldap_init_w_userconf: HOME env is NULL\n" ));
+       LDAP_LOG ( CONFIG, ARGS, "openldap_init_w_userconf: HOME env is NULL\n",
+               0, 0, 0 );
 #else
                Debug(LDAP_DEBUG_TRACE, "ldap_init: HOME env is NULL\n",
                      0, 0, 0);
@@ -283,11 +282,11 @@ static void openldap_ldap_init_w_userconf(const char *file)
                /* we assume UNIX path syntax is used... */
 
                /* try ~/file */
-               sprintf(path, "%s%s%s", home, LDAP_DIRSEP, file);
+               sprintf(path, "%s" LDAP_DIRSEP "%s", home, file);
                openldap_ldap_init_w_conf(path, 1);
 
                /* try ~/.file */
-               sprintf(path, "%s%s.%s", home, LDAP_DIRSEP, file);
+               sprintf(path, "%s" LDAP_DIRSEP ".%s", home, file);
                openldap_ldap_init_w_conf(path, 1);
        }
 
@@ -555,9 +554,9 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
 
                if( altfile != NULL ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( CONFIG, DETAIL1, 
                                "openldap_init_w_userconf: %sCONF env is %s\n",
-                               LDAP_ENV_PREFIX, altfile ));
+                               LDAP_ENV_PREFIX, altfile, 0 );
 #else
                        Debug(LDAP_DEBUG_TRACE, "ldap_init: %s env is %s\n",
                              LDAP_ENV_PREFIX "CONF", altfile, 0);
@@ -566,9 +565,9 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
                }
                else
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( CONFIG, DETAIL1, 
                                "openldap_init_w_userconf: %sCONF env is NULL\n",
-                               LDAP_ENV_PREFIX ));
+                               LDAP_ENV_PREFIX, 0, 0 );
 #else
                        Debug(LDAP_DEBUG_TRACE, "ldap_init: %s env is NULL\n",
                              LDAP_ENV_PREFIX "CONF", 0, 0);
@@ -580,9 +579,9 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
 
                if( altfile != NULL ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( CONFIG, DETAIL1, 
                                "openldap_init_w_userconf: %sRC env is %s\n",
-                               LDAP_ENV_PREFIX, altfile ));
+                               LDAP_ENV_PREFIX, altfile, 0 );
 #else
                        Debug(LDAP_DEBUG_TRACE, "ldap_init: %s env is %s\n",
                              LDAP_ENV_PREFIX "RC", altfile, 0);
@@ -591,9 +590,9 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
                }
                else
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "init", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( CONFIG, DETAIL1, 
                                "openldap_init_w_userconf: %sRC env is NULL\n",
-                               LDAP_ENV_PREFIX ));
+                               LDAP_ENV_PREFIX, 0, 0 );
 #else
                        Debug(LDAP_DEBUG_TRACE, "ldap_init: %s env is NULL\n",
                              LDAP_ENV_PREFIX "RC", 0, 0);
index 372eb9fa0053a98856963865a2abf9a6f1982691..eadf2ac72dd1f8b7266d9a75d49ba52338219217 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "ldap-int.h"
 
-
 /*
  * ldap_kerberos_bind1 - initiate a bind to the ldap server using
  * kerberos authentication.  The dn is supplied.  It is assumed the user
@@ -65,7 +64,7 @@ ldap_kerberos_bind1( LDAP *ld, LDAP_CONST char *dn )
        ber_len_t credlen;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, "ldap_kerberos_bind1\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind1\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind1\n", 0, 0, 0 );
 #endif
@@ -119,7 +118,7 @@ ldap_kerberos_bind1_s( LDAP *ld, LDAP_CONST char *dn )
        LDAPMessage     *res;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, "ldap_kerberos_bind1_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind1_s\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind1_s\n", 0, 0, 0 );
 #endif
@@ -156,7 +155,7 @@ ldap_kerberos_bind2( LDAP *ld, LDAP_CONST char *dn )
        ber_len_t credlen;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, "ldap_kerberos_bind2\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind2\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind2\n", 0, 0, 0 );
 #endif
@@ -205,7 +204,7 @@ ldap_kerberos_bind2_s( LDAP *ld, LDAP_CONST char *dn )
        LDAPMessage     *res;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, "ldap_kerberos_bind2_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind2_s\n" , 0, 0, 0);
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind2_s\n", 0, 0, 0 );
 #endif
@@ -230,7 +229,7 @@ ldap_kerberos_bind_s( LDAP *ld, LDAP_CONST char *dn )
        int     err;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, "ldap_kerberos_bind_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_kerberos_bind_s\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_kerberos_bind_s\n", 0, 0, 0 );
 #endif
@@ -261,17 +260,16 @@ ldap_get_kerberosv4_credentials(
        char            realm[REALM_SZ], *cred, *krbinstance;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "kbind", LDAP_LEVEL_ENTRY, 
-               "ldap_get_kerberosv4_credentials\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
 #endif
 
        if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "kbind", LDAP_LEVEL_ERR, 
+               LDAP_LOG ( OPERATION, ERR, 
                        "ldap_get_kerberosv4_credentials: krb_get_tf_realm failed: %s\n",
-                       krb_err_txt[err] ));
+                       krb_err_txt[err], 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "ldap_get_kerberosv4_credentials: "
                        "krb_get_tf_realm failed: %s\n", krb_err_txt[err], 0, 0 );
@@ -293,9 +291,9 @@ ldap_get_kerberosv4_credentials(
            != KSUCCESS )
        {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "kbind", LDAP_LEVEL_ERR, 
+               LDAP_LOG ( OPERATION, ERR, 
                        "ldap_get_kerberosv4_credentials: krb_mk_req failed: %s\n",
-                       krb_err_txt[err] ));
+                       krb_err_txt[err], 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "ldap_get_kerberosv4_credentials: "
                        "krb_mk_req failed (%s)\n", krb_err_txt[err], 0, 0 );
index cf9f6ed573161c9862ed3c87d4c7f84e4f6a77a5..f3460643704ea6914ee027f7df69b287ce643f7a 100644 (file)
@@ -72,7 +72,7 @@ ldap_modify_ext( LDAP *ld,
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "modify", LDAP_LEVEL_ENTRY, "ldap_modify_ext\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_modify_ext\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_modify_ext\n", 0, 0, 0 );
 #endif
@@ -160,7 +160,7 @@ ldap_modify( LDAP *ld, LDAP_CONST char *dn, LDAPMod **mods )
        int rc, msgid;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "modify", LDAP_LEVEL_ENTRY, "ldap_modify\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_modify\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_modify\n", 0, 0, 0 );
 #endif
index 5603d6dbeace7ac62affc73537098776b611780e..6907a2299859d5f5fd532d656c905485577bd145 100644 (file)
@@ -69,7 +69,7 @@ ldap_rename(
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "modrdn", LDAP_LEVEL_ENTRY, "ldap_rename\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_rename\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_rename\n", 0, 0, 0 );
 #endif
@@ -156,7 +156,7 @@ ldap_rename2(
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "modrdn", LDAP_LEVEL_ENTRY, "ldap_rename2\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_rename2\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_rename2\n", 0, 0, 0 );
 #endif
index 11a9b413318e67f2a750603c5066acc807613d98..8030790a942a9d3d5d26b768553376227b3c4740 100644 (file)
@@ -23,6 +23,7 @@
 #include <ac/time.h>
 
 #include "ldap-int.h"
+#include "ldap_log.h"
 
 int ldap_open_defconn( LDAP *ld )
 {
@@ -55,8 +56,7 @@ ldap_open( LDAP_CONST char *host, int port )
        LDAP            *ld;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "open", LDAP_LEVEL_ARGS, "ldap_open(%s, %d)\n",
-               host, port ));
+       LDAP_LOG ( CONNECTION, ARGS, "ldap_open(%s, %d)\n", host, port, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_open(%s, %d)\n",
                host, port, 0 );
@@ -75,8 +75,8 @@ ldap_open( LDAP_CONST char *host, int port )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "open", LDAP_LEVEL_RESULTS, "ldap_open: %s\n",
-               ld == NULL ? "succeeded" : "failed" ));
+       LDAP_LOG ( CONNECTION, RESULTS, "ldap_open: %s\n",
+               ld == NULL ? "succeeded" : "failed", 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_open: %s\n",
                ld == NULL ? "succeeded" : "failed", 0, 0 );
@@ -107,7 +107,7 @@ ldap_create( LDAP **ldp )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "open", LDAP_LEVEL_ENTRY, "ldap_create\n" ));
+       LDAP_LOG ( CONNECTION, ENTRY, "ldap_create\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_create\n", 0, 0, 0 );
 #endif
@@ -240,7 +240,7 @@ ldap_int_open_connection(
        long addr;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "open", LDAP_LEVEL_ENTRY, "ldap_int_open_connection\n" ));
+       LDAP_LOG ( CONNECTION, ENTRY, "ldap_int_open_connection\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_int_open_connection\n", 0, 0, 0 );
 #endif
diff --git a/libraries/libldap/options.c b/libraries/libldap/options.c
new file mode 100644 (file)
index 0000000..45ceae1
--- /dev/null
@@ -0,0 +1,608 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/stdlib.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#include "ldap-int.h"
+
+#define LDAP_OPT_REBIND_PROC 0x4e814d
+#define LDAP_OPT_REBIND_PARAMS 0x4e814e
+
+static const LDAPAPIFeatureInfo features[] = {
+#ifdef LDAP_API_FEATURE_X_OPENLDAP
+       {       /* OpenLDAP Extensions API Feature */
+               LDAP_FEATURE_INFO_VERSION,
+               "X_OPENLDAP",
+               LDAP_API_FEATURE_X_OPENLDAP
+       },
+#endif
+
+#ifdef LDAP_API_FEATURE_THREAD_SAFE
+       {       /* Basic Thread Safe */
+               LDAP_FEATURE_INFO_VERSION,
+               "THREAD_SAFE",
+               LDAP_API_FEATURE_THREAD_SAFE
+       },
+#endif
+#ifdef LDAP_API_FEATURE_SESSION_THREAD_SAFE
+       {       /* Session Thread Safe */
+               LDAP_FEATURE_INFO_VERSION,
+               "SESSION_THREAD_SAFE",
+               LDAP_API_FEATURE_SESSION_THREAD_SAFE
+       },
+#endif
+#ifdef LDAP_API_FEATURE_OPERATION_THREAD_SAFE
+       {       /* Operation Thread Safe */
+               LDAP_FEATURE_INFO_VERSION,
+               "OPERATION_THREAD_SAFE",
+               LDAP_API_FEATURE_OPERATION_THREAD_SAFE
+       },
+#endif
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+       {       /* OpenLDAP Reentrant */
+               LDAP_FEATURE_INFO_VERSION,
+               "X_OPENLDAP_REENTRANT",
+               LDAP_API_FEATURE_X_OPENLDAP_REENTRANT
+       },
+#endif
+#if defined( LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE ) && \
+       defined( LDAP_THREAD_SAFE )
+       {       /* OpenLDAP Thread Safe */
+               LDAP_FEATURE_INFO_VERSION,
+               "X_OPENLDAP_THREAD_SAFE",
+               LDAP_API_FEATURE_X_OPENLDAP_THREAD_SAFE
+       },
+#endif
+#ifdef LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+       {       /* V2 Referrals */
+               LDAP_FEATURE_INFO_VERSION,
+               "X_OPENLDAP_V2_REFERRALS",
+               LDAP_API_FEATURE_X_OPENLDAP_V2_REFERRALS
+       },
+#endif
+       {0, NULL, 0}
+};
+
+int
+ldap_get_option(
+       LDAP    *ld,
+       int             option,
+       void    *outvalue)
+{
+       struct ldapoptions *lo;
+
+       /* Get pointer to global option structure */
+       lo = LDAP_INT_GLOBAL_OPT();   
+       if (NULL == lo) {
+               return LDAP_NO_MEMORY;
+       }
+
+       if( lo->ldo_valid != LDAP_INITIALIZED ) {
+               ldap_int_initialize(lo, NULL);
+       }
+
+       if(ld != NULL) {
+               assert( LDAP_VALID( ld ) );
+
+               if( !LDAP_VALID( ld ) ) {
+                       return LDAP_OPT_ERROR;
+               }
+
+               lo = &ld->ld_options;
+       }
+
+       if(outvalue == NULL) {
+               /* no place to get to */
+               return LDAP_OPT_ERROR;
+       }
+
+       switch(option) {
+       case LDAP_OPT_API_INFO: {
+                       struct ldapapiinfo *info = (struct ldapapiinfo *) outvalue;
+
+                       if(info == NULL) {
+                               /* outvalue must point to an apiinfo structure */
+                               return LDAP_OPT_ERROR;
+                       }
+
+                       if(info->ldapai_info_version != LDAP_API_INFO_VERSION) {
+                               /* api info version mismatch */
+                               info->ldapai_info_version = LDAP_API_INFO_VERSION;
+                               return LDAP_OPT_ERROR;
+                       }
+
+                       info->ldapai_api_version = LDAP_API_VERSION;
+                       info->ldapai_api_version = LDAP_API_VERSION;
+                       info->ldapai_protocol_version = LDAP_VERSION_MAX;
+
+                       if(features[0].ldapaif_name == NULL) {
+                               info->ldapai_extensions = NULL;
+                       } else {
+                               int i;
+                               info->ldapai_extensions = LDAP_MALLOC(sizeof(char *) *
+                                       sizeof(features)/sizeof(LDAPAPIFeatureInfo));
+
+                               for(i=0; features[i].ldapaif_name != NULL; i++) {
+                                       info->ldapai_extensions[i] =
+                                               LDAP_STRDUP(features[i].ldapaif_name);
+                               }
+
+                               info->ldapai_extensions[i] = NULL;
+                       }
+
+                       info->ldapai_vendor_name = LDAP_STRDUP(LDAP_VENDOR_NAME);
+                       info->ldapai_vendor_version = LDAP_VENDOR_VERSION;
+
+                       return LDAP_OPT_SUCCESS;
+               } break;
+
+       case LDAP_OPT_DESC:
+               if( ld == NULL || ld->ld_sb == NULL ) {
+                       /* bad param */
+                       break;
+               } 
+
+               ber_sockbuf_ctrl( ld->ld_sb, LBER_SB_OPT_GET_FD, outvalue );
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_TIMEOUT:
+               /* the caller has to free outvalue ! */
+               if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_api) != 0 ) {
+                       return LDAP_OPT_ERROR;
+               }
+               return LDAP_OPT_SUCCESS;
+               
+       case LDAP_OPT_NETWORK_TIMEOUT:
+               /* the caller has to free outvalue ! */
+               if ( ldap_int_timeval_dup( outvalue, lo->ldo_tm_net ) != 0 ) {
+                       return LDAP_OPT_ERROR;
+               }
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_DEREF:
+               * (int *) outvalue = lo->ldo_deref;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_SIZELIMIT:
+               * (int *) outvalue = lo->ldo_sizelimit;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_TIMELIMIT:
+               * (int *) outvalue = lo->ldo_timelimit;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_REFERRALS:
+               * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_REFERRALS);
+               return LDAP_OPT_SUCCESS;
+               
+       case LDAP_OPT_RESTART:
+               * (int *) outvalue = (int) LDAP_BOOL_GET(lo, LDAP_BOOL_RESTART);
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_PROTOCOL_VERSION:
+               * (int *) outvalue = lo->ldo_version;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_SERVER_CONTROLS:
+               * (LDAPControl ***) outvalue =
+                       ldap_controls_dup( lo->ldo_sctrls );
+
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_CLIENT_CONTROLS:
+               * (LDAPControl ***) outvalue =
+                       ldap_controls_dup( lo->ldo_cctrls );
+
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_HOST_NAME:
+               * (char **) outvalue = ldap_url_list2hosts(lo->ldo_defludp);
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_URI:
+               * (char **) outvalue = ldap_url_list2urls(lo->ldo_defludp);
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_ERROR_NUMBER:
+               if(ld == NULL) {
+                       /* bad param */
+                       break;
+               } 
+               * (int *) outvalue = ld->ld_errno;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_ERROR_STRING:
+               if(ld == NULL) {
+                       /* bad param */
+                       break;
+               } 
+
+               if( ld->ld_error == NULL ) {
+                       * (char **) outvalue = NULL;
+               } else {
+                       * (char **) outvalue = LDAP_STRDUP(ld->ld_error);
+               }
+
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_MATCHED_DN:
+               if(ld == NULL) {
+                       /* bad param */
+                       break;
+               } 
+
+               if( ld->ld_matched == NULL ) {
+                       * (char **) outvalue = NULL;
+               } else {
+                       * (char **) outvalue = LDAP_STRDUP(ld->ld_matched);
+               }
+
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_API_FEATURE_INFO: {
+                       LDAPAPIFeatureInfo *info = (LDAPAPIFeatureInfo *) outvalue;
+                       int i;
+
+                       if(info == NULL) return LDAP_OPT_ERROR;
+
+                       if(info->ldapaif_info_version != LDAP_FEATURE_INFO_VERSION) {
+                               /* api info version mismatch */
+                               info->ldapaif_info_version = LDAP_FEATURE_INFO_VERSION;
+                               return LDAP_OPT_ERROR;
+                       }
+
+                       if(info->ldapaif_name == NULL) return LDAP_OPT_ERROR;
+
+                       for(i=0; features[i].ldapaif_name != NULL; i++) {
+                               if(!strcmp(info->ldapaif_name, features[i].ldapaif_name)) {
+                                       info->ldapaif_version =
+                                               features[i].ldapaif_version;
+                                       return LDAP_OPT_SUCCESS;
+                               }
+                       }
+               }
+               break;
+
+       case LDAP_OPT_DEBUG_LEVEL:
+               * (int *) outvalue = lo->ldo_debug;
+               return LDAP_OPT_SUCCESS;
+
+       default:
+#ifdef HAVE_TLS
+               if ( ldap_pvt_tls_get_option( ld, option, outvalue ) == 0 ) {
+                       return LDAP_OPT_SUCCESS;
+               }
+#endif
+#ifdef HAVE_CYRUS_SASL
+               if ( ldap_int_sasl_get_option( ld, option, outvalue ) == 0 ) {
+                       return LDAP_OPT_SUCCESS;
+               }
+#endif
+               /* bad param */
+               break;
+       }
+
+       return LDAP_OPT_ERROR;
+}
+
+int
+ldap_set_option(
+       LDAP    *ld,
+       int             option,
+       LDAP_CONST void *invalue)
+{
+       struct ldapoptions *lo;
+       int *dbglvl = NULL;
+
+       /* Get pointer to global option structure */
+       lo = LDAP_INT_GLOBAL_OPT();
+       if (lo == NULL) {
+               return LDAP_NO_MEMORY;
+       }
+
+       /*
+        * The architecture to turn on debugging has a chicken and egg
+        * problem. Thus, we introduce a fix here.
+        */
+
+       if (option == LDAP_OPT_DEBUG_LEVEL)
+           dbglvl = (int *) invalue;
+
+       if( lo->ldo_valid != LDAP_INITIALIZED ) {
+               ldap_int_initialize(lo, dbglvl);
+       }
+
+       if(ld != NULL) {
+               assert( LDAP_VALID( ld ) );
+
+               if( !LDAP_VALID( ld ) ) {
+                       return LDAP_OPT_ERROR;
+               }
+
+               lo = &ld->ld_options;
+       }
+
+       switch(option) {
+       case LDAP_OPT_REFERRALS:
+               if(invalue == LDAP_OPT_OFF) {
+                       LDAP_BOOL_CLR(lo, LDAP_BOOL_REFERRALS);
+               } else {
+                       LDAP_BOOL_SET(lo, LDAP_BOOL_REFERRALS);
+               }
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_RESTART:
+               if(invalue == LDAP_OPT_OFF) {
+                       LDAP_BOOL_CLR(lo, LDAP_BOOL_RESTART);
+               } else {
+                       LDAP_BOOL_SET(lo, LDAP_BOOL_RESTART);
+               }
+               return LDAP_OPT_SUCCESS;
+       }
+
+       /* options which can withstand invalue == NULL */
+       switch ( option ) {
+       case LDAP_OPT_SERVER_CONTROLS: {
+                       LDAPControl *const *controls =
+                               (LDAPControl *const *) invalue;
+
+                       ldap_controls_free( lo->ldo_sctrls );
+
+                       if( controls == NULL || *controls == NULL ) {
+                               lo->ldo_sctrls = NULL;
+                               return LDAP_OPT_SUCCESS;
+                       }
+                               
+                       lo->ldo_sctrls = ldap_controls_dup( controls );
+
+                       if(lo->ldo_sctrls == NULL) {
+                               /* memory allocation error ? */
+                               break;
+                       }
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_CLIENT_CONTROLS: {
+                       LDAPControl *const *controls =
+                               (LDAPControl *const *) invalue;
+
+                       ldap_controls_free( lo->ldo_cctrls );
+
+                       if( controls == NULL || *controls == NULL ) {
+                               lo->ldo_cctrls = NULL;
+                               return LDAP_OPT_SUCCESS;
+                       }
+                               
+                       lo->ldo_cctrls = ldap_controls_dup( controls );
+
+                       if(lo->ldo_cctrls == NULL) {
+                               /* memory allocation error ? */
+                               break;
+                       }
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_TIMEOUT: {
+                       const struct timeval *tv = 
+                               (const struct timeval *) invalue;
+
+                       if ( lo->ldo_tm_api != NULL ) {
+                               LDAP_FREE( lo->ldo_tm_api );
+                               lo->ldo_tm_api = NULL;
+                       }
+
+                       if ( ldap_int_timeval_dup( &lo->ldo_tm_api, tv ) != 0 ) {
+                               return LDAP_OPT_ERROR;
+                       }
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_NETWORK_TIMEOUT: {
+                       const struct timeval *tv = 
+                               (const struct timeval *) invalue;
+
+                       if ( lo->ldo_tm_net != NULL ) {
+                               LDAP_FREE( lo->ldo_tm_net );
+                               lo->ldo_tm_net = NULL;
+                       }
+
+                       if ( ldap_int_timeval_dup( &lo->ldo_tm_net, tv ) != 0 ) {
+                               return LDAP_OPT_ERROR;
+                       }
+               } return LDAP_OPT_SUCCESS;
+
+       /* Only accessed from inside this function by ldap_set_rebind_proc() */
+       case LDAP_OPT_REBIND_PROC: {
+                       lo->ldo_rebind_proc = (LDAP_REBIND_PROC *)invalue;              
+               } return LDAP_OPT_SUCCESS;
+       case LDAP_OPT_REBIND_PARAMS: {
+                       lo->ldo_rebind_params = (void *)invalue;                
+               } return LDAP_OPT_SUCCESS;
+       }
+
+       if(invalue == NULL) {
+               /* no place to set from */
+               return LDAP_OPT_ERROR;
+       }
+
+       /* options which cannot withstand invalue == NULL */
+
+       switch(option) {
+       case LDAP_OPT_API_INFO:
+       case LDAP_OPT_DESC:
+               /* READ ONLY */
+               break;
+
+       case LDAP_OPT_DEREF:
+               lo->ldo_deref = * (const int *) invalue;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_SIZELIMIT:
+               lo->ldo_sizelimit = * (const int *) invalue;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_TIMELIMIT:
+               lo->ldo_timelimit = * (const int *) invalue;
+               return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_PROTOCOL_VERSION: {
+                       int vers = * (const int *) invalue;
+                       if (vers < LDAP_VERSION_MIN || vers > LDAP_VERSION_MAX) {
+                               /* not supported */
+                               break;
+                       }
+                       lo->ldo_version = vers;
+               } return LDAP_OPT_SUCCESS;
+
+
+       case LDAP_OPT_HOST_NAME: {
+                       const char *host = (const char *) invalue;
+                       LDAPURLDesc *ludlist = NULL;
+                       int rc = LDAP_OPT_SUCCESS;
+
+                       if(host != NULL) {
+                               rc = ldap_url_parsehosts( &ludlist, host,
+                                       lo->ldo_defport ? lo->ldo_defport : LDAP_PORT );
+
+                       } else if(ld == NULL) {
+                               /*
+                                * must want global default returned
+                                * to initial condition.
+                                */
+                               rc = ldap_url_parselist(&ludlist, "ldap://localhost/");
+
+                       } else {
+                               /*
+                                * must want the session default
+                                *   updated to the current global default
+                                */
+                               ludlist = ldap_url_duplist(
+                                       ldap_int_global_options.ldo_defludp);
+                               if (ludlist == NULL)
+                                       rc = LDAP_NO_MEMORY;
+                       }
+
+                       if (rc == LDAP_OPT_SUCCESS) {
+                               if (lo->ldo_defludp != NULL)
+                                       ldap_free_urllist(lo->ldo_defludp);
+                               lo->ldo_defludp = ludlist;
+                       }
+                       return rc;
+               }
+
+       case LDAP_OPT_URI: {
+                       const char *urls = (const char *) invalue;
+                       LDAPURLDesc *ludlist = NULL;
+                       int rc = LDAP_OPT_SUCCESS;
+
+                       if(urls != NULL) {
+                               rc = ldap_url_parselist(&ludlist, urls);
+
+                       } else if(ld == NULL) {
+                               /*
+                                * must want global default returned
+                                * to initial condition.
+                                */
+                               rc = ldap_url_parselist(&ludlist, "ldap://localhost/");
+
+                       } else {
+                               /*
+                                * must want the session default
+                                *   updated to the current global default
+                                */
+                               ludlist = ldap_url_duplist(
+                                       ldap_int_global_options.ldo_defludp);
+                               if (ludlist == NULL)
+                                       rc = LDAP_NO_MEMORY;
+                       }
+
+                       if (rc == LDAP_OPT_SUCCESS) {
+                               if (lo->ldo_defludp != NULL)
+                                       ldap_free_urllist(lo->ldo_defludp);
+                               lo->ldo_defludp = ludlist;
+                       }
+                       return rc;
+               }
+
+       case LDAP_OPT_ERROR_NUMBER: {
+                       int err = * (const int *) invalue;
+
+                       if(ld == NULL) {
+                               /* need a struct ldap */
+                               break;
+                       }
+
+                       ld->ld_errno = err;
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_ERROR_STRING: {
+                       const char *err = (const char *) invalue;
+
+                       if(ld == NULL) {
+                               /* need a struct ldap */
+                               break;
+                       }
+
+                       if( ld->ld_error ) {
+                               LDAP_FREE(ld->ld_error);
+                       }
+
+                       ld->ld_error = LDAP_STRDUP(err);
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_MATCHED_DN: {
+                       const char *err = (const char *) invalue;
+
+                       if(ld == NULL) {
+                               /* need a struct ldap */
+                               break;
+                       }
+
+                       if( ld->ld_matched ) {
+                               LDAP_FREE(ld->ld_matched);
+                       }
+
+                       ld->ld_matched = LDAP_STRDUP(err);
+               } return LDAP_OPT_SUCCESS;
+
+       case LDAP_OPT_API_FEATURE_INFO:
+               /* read-only */
+               break;
+
+       case LDAP_OPT_DEBUG_LEVEL:
+               lo->ldo_debug = * (const int *) invalue;
+               return LDAP_OPT_SUCCESS;
+
+       default:
+#ifdef HAVE_TLS
+               if ( ldap_pvt_tls_set_option( ld, option, (void *)invalue ) == 0 )
+               return LDAP_OPT_SUCCESS;
+#endif
+#ifdef HAVE_CYRUS_SASL
+               if ( ldap_int_sasl_set_option( ld, option, (void *)invalue ) == 0 )
+                       return LDAP_OPT_SUCCESS;
+#endif
+               /* bad param */
+               break;
+       }
+       return LDAP_OPT_ERROR;
+}
+
+int
+ldap_set_rebind_proc( LDAP *ld, LDAP_REBIND_PROC *proc, void *params )
+{
+       int rc;
+       rc = ldap_set_option( ld, LDAP_OPT_REBIND_PROC, (void *)proc );
+       if( rc != LDAP_OPT_SUCCESS ) return rc;
+
+       rc = ldap_set_option( ld, LDAP_OPT_REBIND_PARAMS, (void *)params );
+       return rc;
+}
index 7412a58014d067c5b702ae566db0dd77bff2ed90..d549c7f324053acb01484899e92478ccd2c6deb1 100644 (file)
 int ldap_int_tblsize = 0;
 
 #if defined( HAVE_GETADDRINFO ) && defined( HAVE_INET_NTOP )
+#  ifdef LDAP_PF_INET6
 int ldap_int_inet4or6 = AF_UNSPEC;
+#  else
+int ldap_int_inet4or6 = AF_INET;
+#  endif
 #endif
 
 /*
@@ -197,6 +201,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
        struct sockaddr *sin, socklen_t addrlen,
        int async)
 {
+       int rc;
        struct timeval  tv, *opt_tv=NULL;
        fd_set          wfds, *z=NULL;
 #ifdef HAVE_WINSOCK
@@ -226,8 +231,7 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
        if ( ldap_pvt_ndelay_on(ld, s) == -1 )
                return ( -1 );
 
-       if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR )
-       {
+       if ( connect(s, sin, addrlen) != AC_SOCKET_ERROR ) {
                if ( ldap_pvt_ndelay_off(ld, s) == -1 )
                        return ( -1 );
                return ( 0 );
@@ -253,16 +257,18 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s,
        FD_SET(s, &efds );
 #endif
 
-       if ( select(ldap_int_tblsize, z, &wfds,
+       do {
+               rc = select(ldap_int_tblsize, z, &wfds,
 #ifdef HAVE_WINSOCK
-                   &efds,
+                       &efds,
 #else
-                   z,
+                       z,
 #endif
-                   opt_tv ? &tv : NULL) == AC_SOCKET_ERROR )
-       {
-               return ( -1 );
-       }
+                       opt_tv ? &tv : NULL);
+       } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
+               LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
+
+       if( rc == AC_SOCKET_ERROR ) return rc;
 
 #ifdef HAVE_WINSOCK
        /* This means the connection failed */
@@ -686,7 +692,7 @@ ldap_int_select( LDAP *ld, struct timeval *timeout )
        struct selectinfo       *sip;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "os-ip", LDAP_LEVEL_ENTRY, "ldap_int_select\n" ));
+       LDAP_LOG ( CONNECTION, ENTRY, "ldap_int_select\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_int_select\n", 0, 0, 0 );
 #endif
index 8b3da9f2285d919e42e786f8f973b2b649f404b2..b752a382feb454182a27cd29298001362bc40b9d 100644 (file)
@@ -134,6 +134,7 @@ ldap_pvt_is_socket_ready(LDAP *ld, int s)
 static int
 ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
 {
+       int rc;
        struct timeval  tv, *opt_tv=NULL;
        fd_set          wfds, *z=NULL;
 
@@ -168,11 +169,12 @@ ldap_pvt_connect(LDAP *ld, ber_socket_t s, struct sockaddr_un *sa, int async)
        FD_ZERO(&wfds);
        FD_SET(s, &wfds );
 
-       if ( select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL)
-               == AC_SOCKET_ERROR )
-       {
-               return ( -1 );
-       }
+       do { 
+               rc = select(ldap_int_tblsize, z, &wfds, z, opt_tv ? &tv : NULL);
+       } while( rc == AC_SOCKET_ERROR && errno == EINTR &&
+               LDAP_BOOL_GET(&ld->ld_options, LDAP_BOOL_RESTART ));
+
+       if( rc == AC_SOCKET_ERROR ) return rc;
 
        if ( FD_ISSET(s, &wfds) ) {
                if ( ldap_pvt_is_socket_ready(ld, s) == -1 )
index 3c4d2347f7cbe8cbdcdcddf0758843f5e2740f53..b9ecd9b3bd3a8ca7b50962b4fabfc288b1518e95 100644 (file)
@@ -84,7 +84,7 @@ ldap_send_initial_request(
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_send_initial_request\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_send_initial_request\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_send_initial_request\n", 0, 0, 0 );
 #endif
@@ -99,8 +99,9 @@ ldap_send_initial_request(
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
-                       "ldap_send_initial_request: ldap_open_defconn: successful\n" ));
+               LDAP_LOG ( OPERATION, DETAIL1, 
+                       "ldap_send_initial_request: ldap_open_defconn: successful\n" , 
+                       0, 0, 0);
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_open_defconn: successful\n",
@@ -151,7 +152,7 @@ ldap_send_server_request(
        int incparent;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_send_server_request\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_send_server_request\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_send_server_request\n", 0, 0, 0 );
 #endif
@@ -263,7 +264,7 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
        Sockbuf         *sb = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_new_connection\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_new_connection\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_new_connection\n", 0, 0, 0 );
 #endif
@@ -329,8 +330,9 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
                                ld->ld_defconn = lc;
 
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
-                                       "ldap_new_connection: Call application rebind_proc\n" ));
+                               LDAP_LOG ( OPERATION, DETAIL1, 
+                                       "ldap_new_connection: Call application rebind_proc\n", 
+                                       0, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE, "Call application rebind_proc\n", 0, 0, 0);
 #endif
@@ -354,8 +356,9 @@ ldap_new_connection( LDAP *ld, LDAPURLDesc *srvlist, int use_ldsb,
                        ld->ld_defconn = lc;
 
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
-                               "ldap_new_connection: anonymous rebind via ldap_bind_s\n" ));
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "ldap_new_connection: anonymous rebind via ldap_bind_s\n", 
+                               0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "anonymous rebind via ldap_bind_s\n", 0, 0, 0);
 #endif
@@ -422,7 +425,7 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
        LDAPConn        *tmplc, *prevlc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_free_connection\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_free_connection\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_free_connection\n", 0, 0, 0 );
 #endif
@@ -472,8 +475,8 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
                }
                LDAP_FREE( lc );
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_RESULTS, 
-                       "ldap_free_connection: actually freed\n" ));
+               LDAP_LOG ( OPERATION, RESULTS, 
+                       "ldap_free_connection: actually freed\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: actually freed\n",
                    0, 0, 0 );
@@ -481,8 +484,8 @@ ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind )
        } else {
                lc->lconn_lastused = time( NULL );
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_RESULTS
-                       "ldap_free_connection: refcnt %d\n", lc->lconn_refcnt ));
+               LDAP_LOG ( OPERATION, RESULTS, "ldap_free_connection: refcnt %d\n"
+                       lc->lconn_refcnt, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "ldap_free_connection: refcnt %d\n",
                    lc->lconn_refcnt, 0, 0 );
@@ -612,9 +615,8 @@ ldap_free_request( LDAP *ld, LDAPRequest *lr )
        LDAPRequest     **ttmplr;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ARGS, 
-               "ldap_free_request (origid %d, msgid %d)\n",
-               lr->lr_origid, lr->lr_msgid ));
+       LDAP_LOG ( OPERATION, ARGS, "ldap_free_request (origid %d, msgid %d)\n",
+               lr->lr_origid, lr->lr_msgid, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_free_request (origid %d, msgid %d)\n",
                lr->lr_origid, lr->lr_msgid, 0 );
@@ -665,7 +667,7 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
        *hadrefp = 0;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_chase_v3referrals\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_chase_v3referrals\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_chase_v3referrals\n", 0, 0, 0 );
 #endif
@@ -682,9 +684,9 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
        /* Check for hop limit exceeded */
        if ( lr->lr_parentcnt >= ld->ld_refhoplimit ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
+               LDAP_LOG ( OPERATION, DETAIL1, 
                        "ldap_chase_v3referrals: more than %d referral hops (dropping)\n",
-                       ld->ld_refhoplimit ));
+                       ld->ld_refhoplimit, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                    "more than %d referral hops (dropping)\n", ld->ld_refhoplimit, 0, 0 );
@@ -737,9 +739,9 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
                                 * for the same server with different contexts.
                                 */
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
+                               LDAP_LOG ( OPERATION, DETAIL1, 
                                        "ldap_chase_v3referrals: queue referral \"%s\"\n",
-                                       refarray[i] ));
+                                       refarray[i], 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "ldap_chase_v3referrals: queue referral \"%s\"\n",
@@ -807,9 +809,9 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
+               LDAP_LOG ( OPERATION, DETAIL1, 
                        "ldap_chase_v3referrals: msgid %d, url \"%s\"\n",
-                       lr->lr_msgid, refarray[i] ));
+                       lr->lr_msgid, refarray[i], 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_chase_v3referral: msgid %d, url \"%s\"\n",
@@ -823,9 +825,9 @@ ldap_chase_v3referrals( LDAP *ld, LDAPRequest *lr, char **refs, int sref, char *
                        origreq, srv, NULL, &rinfo )) < 0 ) {
                        /* Failure, try next referral in the list */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "request", LDAP_LEVEL_ERR, 
+                       LDAP_LOG ( OPERATION, ERR, 
                        "ldap_chase_v3referrals: Unable to chase referral \"%s\" (%s)\n",
-                       refarray[i], ldap_err2string( ld->ld_errno ) ));
+                       refarray[i], ldap_err2string( ld->ld_errno ), 0 );
 #else
                        Debug( LDAP_DEBUG_ANY, "Unable to chase referral \"%s\" (%s)\n", 
                                refarray[i], ldap_err2string( ld->ld_errno ), 0);
@@ -908,7 +910,7 @@ ldap_chase_referrals( LDAP *ld,
        LDAPreqinfo  rinfo;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, "ldap_chase_referrals\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_chase_referrals\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_chase_referrals\n", 0, 0, 0 );
 #endif
@@ -935,9 +937,9 @@ ldap_chase_referrals( LDAP *ld,
 
        if ( lr->lr_parentcnt >= ld->ld_refhoplimit ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_ENTRY, 
+               LDAP_LOG ( OPERATION, ENTRY, 
                        "ldap_chase_referrals: more than %d referral hops (dropping)\n",
-                       ld->ld_refhoplimit ));
+                       ld->ld_refhoplimit, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                    "more than %d referral hops (dropping)\n",
@@ -968,9 +970,9 @@ ldap_chase_referrals( LDAP *ld,
 
                if ( rc != LDAP_URL_SUCCESS ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( OPERATION, DETAIL1, 
                                "ldap_chase_referrals: ignoring unknown referral <%s>\n",
-                               ref ));
+                               ref, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                            "ignoring unknown referral <%s>\n", ref, 0, 0 );
@@ -986,8 +988,8 @@ ldap_chase_referrals( LDAP *ld,
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1, 
-                       "ldap_chase_referrals: chasing LDAP referral <%s>\n", ref ));
+               LDAP_LOG ( OPERATION, DETAIL1, 
+                       "ldap_chase_referrals: chasing LDAP referral <%s>\n", ref, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                    "chasing LDAP referral: <%s>\n", ref, 0, 0 );
@@ -1016,9 +1018,9 @@ ldap_chase_referrals( LDAP *ld,
                        ++count;
                } else {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "request", LDAP_LEVEL_ERR, 
+                       LDAP_LOG ( OPERATION, ERR, 
                                "ldap_chase_referrals: Unable to chase referral <%s>\n", 
-                               ldap_err2string( ld->ld_errno) ));
+                               ldap_err2string( ld->ld_errno), 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                            "Unable to chase referral (%s)\n", 
@@ -1091,10 +1093,10 @@ re_encode_request( LDAP *ld,
        char            *dn;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "request", LDAP_LEVEL_ARGS, 
+       LDAP_LOG ( OPERATION, ARGS, 
                "re_encode_request: new msgid %ld, new dn <%s>\n",
                (long) msgid, 
-               ( srv == NULL || srv->lud_dn == NULL ) ? "NONE" : srv->lud_dn ));
+               ( srv == NULL || srv->lud_dn == NULL ) ? "NONE" : srv->lud_dn, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE,
            "re_encode_request: new msgid %ld, new dn <%s>\n",
@@ -1192,8 +1194,8 @@ re_encode_request( LDAP *ld,
 #ifdef LDAP_DEBUG
        if ( ldap_debug & LDAP_DEBUG_PACKETS ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "request", LDAP_LEVEL_DETAIL1,
-                       "re_encode_request: new request is:\n" ));
+               LDAP_LOG ( OPERATION, DETAIL1, 
+                       "re_encode_request: new request is:\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "re_encode_request new request is:\n",
                    0, 0, 0 );
index a1ee317cf6d31e78de76eb77fbcf554ba7674300..1a7bcec9efff41fa9bd692f91cab037538a24cea 100644 (file)
@@ -53,7 +53,7 @@
 #include <ac/unistd.h>
 
 #include "ldap-int.h"
-
+#include "ldap_log.h"
 
 static int ldap_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid ));
 static int ldap_mark_abandoned LDAP_P(( LDAP *ld, ber_int_t msgid ));
@@ -98,7 +98,7 @@ ldap_result(
        assert( result != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_ARGS, "ldap_result msgid %d\n", msgid ));
+       LDAP_LOG ( OPERATION, ARGS, "ldap_result msgid %d\n", msgid, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_result msgid %d\n", msgid, 0, 0 );
 #endif
@@ -129,8 +129,8 @@ chkResponseList(
         */
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_ARGS
-               "ldap_chkResponseList for msgid=%d, all=%d\n", msgid, all ));
+       LDAP_LOG ( OPERATION, ARGS, "ldap_chkResponseList for msgid=%d, all=%d\n"
+               msgid, all, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE,
                "ldap_chkResponseList for msgid=%d, all=%d\n",
@@ -142,8 +142,8 @@ chkResponseList(
 
                if ( ldap_abandoned( ld, lm->lm_msgid ) ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-                               "ldap_chkResponseList msg abandoned, msgid %d\n", msgid ));
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "ldap_chkResponseList msg abandoned, msgid %d\n", msgid, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                "ldap_chkResponseList msg abandoned, msgid %d\n",
@@ -207,17 +207,17 @@ chkResponseList(
 #ifdef LDAP_DEBUG
        if( lm == NULL) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_RESULTS, 
-                       "ldap_chkResponseList returns NULL\n" ));
+               LDAP_LOG ( OPERATION, RESULTS, "ldap_chkResponseList returns NULL\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_chkResponseList returns NULL\n", 0, 0, 0);
 #endif
        } else {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_RESULTS, 
-                       "ldap_chkResponseList returns msgid %d, type 0x02lu\n",
-                       lm->lm_msgid, (unsigned long) lm->lm_msgtype ));
+               LDAP_LOG ( OPERATION, RESULTS, 
+                       "ldap_chkResponseList returns msgid %d, type 0x%02lu\n",
+                       lm->lm_msgid, (unsigned long) lm->lm_msgtype, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_chkResponseList returns msgid %d, type 0x%02lu\n",
@@ -248,17 +248,17 @@ wait4msg(
 #ifdef LDAP_DEBUG
        if ( timeout == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_ARGS,
-                       "wait4msg (infinite timeout), msgid %d\n", msgid ));
+               LDAP_LOG ( OPERATION, ARGS, 
+                       "wait4msg (infinite timeout), msgid %d\n", msgid, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "wait4msg (infinite timeout), msgid %d\n",
                    msgid, 0, 0 );
 #endif
        } else {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_ARGS,
+               LDAP_LOG ( OPERATION, ARGS, 
                        "wait4msg (timeout %ld sec, %ld usec), msgid %d\n", 
-                       (long) timeout->tv_sec, (long) timeout->tv_usec, msgid ));
+                       (long) timeout->tv_sec, (long) timeout->tv_usec, msgid );
 #else
                Debug( LDAP_DEBUG_TRACE, "wait4msg (timeout %ld sec, %ld usec), msgid %d\n",
                       (long) timeout->tv_sec, (long) timeout->tv_usec, msgid );
@@ -278,8 +278,8 @@ wait4msg(
        while ( rc == -2 ) {
 #ifdef LDAP_DEBUG
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_ARGS,
-                       "wait4msg continue, msgid %d, all %d\n", msgid, all ));
+               LDAP_LOG ( OPERATION, ARGS, 
+                       "wait4msg continue, msgid %d, all %d\n", msgid, all, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE, "wait4msg continue, msgid %d, all %d\n",
                    msgid, all, 0 );
@@ -310,9 +310,9 @@ wait4msg(
 #ifdef LDAP_DEBUG
                            if ( rc == -1 ) {
 #ifdef NEW_LOGGING
-                                       LDAP_LOG (( "result", LDAP_LEVEL_ARGS,
+                                       LDAP_LOG ( OPERATION, ARGS, 
                                                "wait4msg: ldap_int_select returned -1: errno %d\n", 
-                                               errno ));
+                                               errno, 0, 0 );
 #else
                                Debug( LDAP_DEBUG_TRACE,
                                        "ldap_int_select returned -1: errno %d\n",
@@ -358,8 +358,8 @@ wait4msg(
                        }
 
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1,
-                               "wait4msg: %ld secs to go\n", (long) tv.tv_sec ));
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "wait4msg: %ld secs to go\n", (long) tv.tv_sec, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE, "wait4msg:  %ld secs to go\n",
                               (long) tv.tv_sec, 0, 0 );
@@ -401,8 +401,7 @@ try_read1msg(
        assert( lc != NULL );
        
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_ARGS, "read1msg: msgid %d, all %d\n",
-               msgid, all ));
+       LDAP_LOG ( OPERATION, ARGS, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "read1msg: msgid %d, all %d\n", msgid, all, 0 );
 #endif
@@ -431,8 +430,8 @@ try_read1msg(
                if ( tag == LBER_DEFAULT) {
 #ifdef LDAP_DEBUG                 
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-                               "read1msg: ber_get_next failed\n" ));
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "read1msg: ber_get_next failed\n", 0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_CONNS,
                              "ber_get_next failed.\n", 0, 0, 0 );
@@ -468,8 +467,7 @@ try_read1msg(
        if ( ldap_abandoned( ld, id ) ) {
                ber_free( ber, 1 );
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-                       "read1msg: abandoned\n" ));
+               LDAP_LOG ( OPERATION, DETAIL1, "read1msg: abandoned\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY, "abandoned\n", 0, 0, 0);
 #endif
@@ -478,9 +476,9 @@ try_read1msg(
 
        if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+               LDAP_LOG ( OPERATION, DETAIL1, 
                        "read1msg: no request for response with msgid %ld (tossing)\n",
-                       (long) id ));
+                       (long) id, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                    "no request for response with msgid %ld (tossing)\n",
@@ -503,10 +501,10 @@ try_read1msg(
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+       LDAP_LOG ( OPERATION, DETAIL1, 
                "read1msg: ldap_read: message type %s msgid %ld, original id %ld\n",
            ldap_int_msgtype2str( tag ),
-               (long) lr->lr_msgid, (long) lr->lr_origid ));
+               (long) lr->lr_msgid, (long) lr->lr_origid );
 #else
        Debug( LDAP_DEBUG_TRACE,
                "ldap_read: message type %s msgid %ld, original id %ld\n",
@@ -548,10 +546,10 @@ try_read1msg(
                                                if( lr->lr_status != LDAP_REQST_COMPLETED) {
                                                        lr->lr_status = LDAP_REQST_CHASINGREFS;
 #ifdef NEW_LOGGING
-                                                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+                                                       LDAP_LOG ( OPERATION, DETAIL1, 
                                                                "read1msg: search ref chased,"
                                                                "mark request chasing refs, id =        %d\n",
-                                                               lr->lr_msgid ));
+                                                               lr->lr_msgid, 0, 0 );
 #else
                                                        Debug( LDAP_DEBUG_TRACE,
                                                            "read1msg:  search ref chased, mark request chasing refs, id = %d\n",
@@ -581,10 +579,10 @@ try_read1msg(
                                                        rc = LDAP_DECODING_ERROR;
                                                        lr->lr_status = LDAP_REQST_COMPLETED;
 #ifdef NEW_LOGGING
-                                                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+                                                       LDAP_LOG ( OPERATION, DETAIL1, 
                                                                "read1msg: referral decode error,"
                                                                "mark request completed, id =   %d\n",
-                                                               lr->lr_msgid ));
+                                                               lr->lr_msgid, 0, 0 );
 #else
                                                        Debug( LDAP_DEBUG_TRACE,
                                                            "read1msg: referral decode error, mark request completed, id = %d\n",
@@ -598,10 +596,10 @@ try_read1msg(
                                                            0, &lr->lr_res_error, &hadref );
                                                        lr->lr_status = LDAP_REQST_COMPLETED;
 #ifdef NEW_LOGGING
-                                                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+                                                       LDAP_LOG ( OPERATION, DETAIL1, 
                                                                "read1msg: referral chased,"
                                                                "mark request completed, id =   %d\n",
-                                                               lr->lr_msgid ));
+                                                               lr->lr_msgid, 0, 0 );
 #else
                                                        Debug( LDAP_DEBUG_TRACE,
                                                            "read1msg:  referral chased, mark request completed, id = %d\n",
@@ -654,10 +652,10 @@ try_read1msg(
                                                &lr->lr_res_error, -1, &hadref );
                                        lr->lr_status = LDAP_REQST_COMPLETED;
 #ifdef NEW_LOGGING
-                                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+                                       LDAP_LOG ( OPERATION, DETAIL1, 
                                                "read1msg: V2 referral chased,"
                                                "mark request completed, id =   %d\n",
-                                               lr->lr_msgid ));
+                                               lr->lr_msgid, 0, 0 );
 #else
                                        Debug( LDAP_DEBUG_TRACE,
                                            "read1msg:  V2 referral chased, mark request completed, id = %d\n", lr->lr_msgid, 0, 0);
@@ -675,10 +673,10 @@ try_read1msg(
                                        lr->lr_res_errno = LDAP_PARTIAL_RESULTS;
                                }
 #ifdef NEW_LOGGING
-LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+LDAP_LOG ( OPERATION, DETAIL1, 
        "read1msg: new result: res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
     lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
-    lr->lr_res_matched ? lr->lr_res_matched : "" ));
+    lr->lr_res_matched ? lr->lr_res_matched : "" );
 #else
 Debug( LDAP_DEBUG_TRACE,
     "new result:  res_errno: %d, res_error: <%s>, res_matched: <%s>\n",
@@ -689,8 +687,8 @@ Debug( LDAP_DEBUG_TRACE,
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1
-                       "read1msg: %d new referrals\n", refer_cnt ));
+               LDAP_LOG ( OPERATION, DETAIL1, "read1msg: %d new referrals\n"
+                       refer_cnt, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                    "read1msg:  %d new referrals\n", refer_cnt, 0, 0 );
@@ -715,8 +713,9 @@ Debug( LDAP_DEBUG_TRACE,
 
                        lr->lr_status = LDAP_REQST_COMPLETED; /* declare this request done */
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-                               "read1msg: mark request completed, id = %d\n", lr->lr_msgid ));
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "read1msg: mark request completed, id = %d\n", 
+                               lr->lr_msgid, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                            "read1msg:  mark request completed, id = %d\n", lr->lr_msgid, 0, 0);
@@ -745,12 +744,12 @@ Debug( LDAP_DEBUG_TRACE,
                                id = lr->lr_msgid;
                                tag = lr->lr_res_msgtype;
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-                               "read1msg: request %ld done\n", (long) id ));
-                       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+                       LDAP_LOG ( OPERATION, DETAIL1, 
+                               "read1msg: request %ld done\n", (long) id, 0, 0 );
+                       LDAP_LOG ( OPERATION, DETAIL1, 
                                "read1msg: res_errno: %d,res_error: <%s>, res_matched: <%s>\n",
                                lr->lr_res_errno, lr->lr_res_error ? lr->lr_res_error : "",
-                               lr->lr_res_matched ? lr->lr_res_matched : "" ));
+                               lr->lr_res_matched ? lr->lr_res_matched : "" );
 #else
                                Debug( LDAP_DEBUG_ANY, "request %ld done\n",
                                    (long) id, 0, 0 );
@@ -838,9 +837,9 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
+       LDAP_LOG ( OPERATION, DETAIL1, 
                "read1msg: adding response id %ld type %ld\n",
-               (long) new->lm_msgid, (long) new->lm_msgtype ));
+               (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "adding response id %ld type %ld:\n",
            (long) new->lm_msgid, (long) new->lm_msgtype, 0 );
@@ -964,12 +963,12 @@ merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
        }
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_DETAIL1, 
-               "read1msg: merged parent (id %d) error info: result errno %d, "
-               "error <%s>, matched <%s>\n", parentr->lr_msgid,
+       LDAP_LOG( OPERATION, DETAIL1, "merged parent (id %d) error info:  ",
+           parentr->lr_msgid, 0, 0 );
+       LDAP_LOG( OPERATION, DETAIL1, "result errno %d, error <%s>, matched <%s>\n",
            parentr->lr_res_errno, parentr->lr_res_error ?
            parentr->lr_res_error : "", parentr->lr_res_matched ?
-           parentr->lr_res_matched : "" ));
+           parentr->lr_res_matched : "" );
 #else
        Debug( LDAP_DEBUG_TRACE, "merged parent (id %d) error info:  ",
            parentr->lr_msgid, 0, 0 );
@@ -1024,7 +1023,7 @@ ldap_msgfree( LDAPMessage *lm )
        int             type = 0;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_ENTRY, "ldap_msgfree\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_msgfree\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_msgfree\n", 0, 0, 0 );
 #endif
@@ -1052,7 +1051,7 @@ ldap_msgdelete( LDAP *ld, int msgid )
        assert( ld != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "result", LDAP_LEVEL_ENTRY, "ldap_msgdelete\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_msgdelete\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_msgdelete\n", 0, 0, 0 );
 #endif
index 0164bc962fc02d9ee660f12aa032dceb39d73cbc..e5c64921d5ad82c57ea6ce2b52107d1ea8dd7d30 100644 (file)
@@ -62,7 +62,7 @@ ldap_sasl_bind(
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_sasl_bind\n" ));
+       LDAP_LOG ( TRANSPORT, ENTRY, "ldap_sasl_bind\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind\n", 0, 0, 0 );
 #endif
@@ -169,7 +169,7 @@ ldap_sasl_bind_s(
        struct berval   *scredp = NULL;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_sasl_bind_s\n" ));
+       LDAP_LOG ( TRANSPORT, ENTRY, "ldap_sasl_bind_s\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_sasl_bind_s\n", 0, 0, 0 );
 #endif
@@ -255,7 +255,7 @@ ldap_parse_sasl_bind_result(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_parse_sasl_bind_result\n" ));
+       LDAP_LOG ( TRANSPORT, ENTRY, "ldap_parse_sasl_bind_result\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_parse_sasl_bind_result\n", 0, 0, 0 );
 #endif
@@ -368,7 +368,7 @@ ldap_pvt_sasl_getmechs ( LDAP *ld, char **pmechlist )
        int rc;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sasl", LDAP_LEVEL_ENTRY, "ldap_pvt_sasl_getmech\n" ));
+       LDAP_LOG ( TRANSPORT, ENTRY, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
 #endif
@@ -456,8 +456,9 @@ ldap_sasl_interactive_bind_s(
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "sasl", LDAP_LEVEL_DETAIL1, 
-                       "ldap_interactive_sasl_bind_s: server supports: %s\n", smechs ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                       "ldap_interactive_sasl_bind_s: server supports: %s\n", 
+                       smechs, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_interactive_sasl_bind_s: server supports: %s\n",
@@ -468,8 +469,8 @@ ldap_sasl_interactive_bind_s(
 
        } else {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "sasl", LDAP_LEVEL_DETAIL1, 
-                       "ldap_interactive_sasl_bind_s: user selected: %s\n", mechs ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                       "ldap_interactive_sasl_bind_s: user selected: %s\n", mechs, 0, 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                        "ldap_interactive_sasl_bind_s: user selected: %s\n",
index eb8aaed4bd57f564e125b6011efa549c53f713cd..1d016bbf9233d18a75ac78abb94c7e8317c5559c 100644 (file)
@@ -41,7 +41,6 @@
 
 #include "ldap-int.h"
 
-
 /*
  * ldap_simple_bind - bind to the ldap server (and X.500).  The dn and
  * password of the entry to which to bind are supplied.  The message id
@@ -63,7 +62,7 @@ ldap_simple_bind(
        struct berval cred;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sbind", LDAP_LEVEL_ENTRY, "ldap_simple_bind\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_simple_bind\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind\n", 0, 0, 0 );
 #endif
@@ -102,7 +101,7 @@ ldap_simple_bind_s( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd )
        struct berval cred;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "sbind", LDAP_LEVEL_ENTRY, "ldap_simple_bind_s\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_simple_bind_s\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_simple_bind_s\n", 0, 0, 0 );
 #endif
index 4fd83bc4bd182bbd95ba5eb69c4014bca89fd0c4..93a1daf381a10ab12a2b8bf451abccc5e17a1507 100644 (file)
@@ -281,7 +281,7 @@ print_noidlen(safe_string *ss, char *s, int l)
 
        ret = print_numericoid(ss,s);
        if ( l ) {
-               sprintf(buf,"{%d}",l);
+               snprintf(buf, sizeof buf, "{%d}",l);
                ret = print_literal(ss,buf);
        }
        return(ret);
index c0bc46df7899dae708c45b7ce4e559d476bc1fb2..2817e650826ddfb9c720510c6d65e72fe2510e39 100644 (file)
@@ -21,7 +21,7 @@
 #include <ac/time.h>
 
 #include "ldap-int.h"
-
+#include "ldap_log.h"
 
 /*
  * ldap_search_ext - initiate an ldap search operation.
@@ -62,7 +62,7 @@ ldap_search_ext(
        int timelimit;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "search", LDAP_LEVEL_ENTRY, "ldap_search_ext\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_search_ext\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_search_ext\n", 0, 0, 0 );
 #endif
@@ -184,7 +184,7 @@ ldap_search(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "search", LDAP_LEVEL_ENTRY, "ldap_search\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_search\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_search\n", 0, 0, 0 );
 #endif
index f7f27bce46d01ca1bc1e61d88da6d6c445bcea92..e8c8c266c4fcee336521ebe24b81a56260614b95 100644 (file)
@@ -180,9 +180,9 @@ ldap_pvt_tls_init_def_ctx( void )
                tls_def_ctx = SSL_CTX_new( SSLv23_method() );
                if ( tls_def_ctx == NULL ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: "
                                "TLS could not allocate default ctx (%d).\n",
-                               ERR_peek_error() ));
+                               ERR_peek_error(), 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                           "TLS: could not allocate default ctx (%lu).\n",
@@ -195,9 +195,9 @@ ldap_pvt_tls_init_def_ctx( void )
                        !SSL_CTX_set_cipher_list( tls_def_ctx, tls_opt_ciphersuite ) )
                {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: "
                                "TLS could not set cipher list %s.\n",
-                               tls_opt_ciphersuite ));
+                               tls_opt_ciphersuite, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                   "TLS: could not set cipher list %s.\n",
@@ -213,12 +213,12 @@ ldap_pvt_tls_init_def_ctx( void )
                                !SSL_CTX_set_default_verify_paths( tls_def_ctx ) )
                        {
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "tls", LDAP_LEVEL_ERR,
+                               LDAP_LOG ( TRANSPORT, ERR, 
                                        "ldap_pvt_tls_init_def_ctx: "
                                        "TLS could not load verify locations "
                                        "(file:`%s',dir:`%s').\n",
                                        tls_opt_cacertfile ? tls_opt_cacertfile : "",
-                                       tls_opt_cacertdir ? tls_opt_cacertdir : "" ));
+                                       tls_opt_cacertdir ? tls_opt_cacertdir : "", 0 );
 #else
                                Debug( LDAP_DEBUG_ANY, "TLS: "
                                        "could not load verify locations (file:`%s',dir:`%s').\n",
@@ -233,10 +233,10 @@ ldap_pvt_tls_init_def_ctx( void )
                        calist = get_ca_list( tls_opt_cacertfile, tls_opt_cacertdir );
                        if ( !calist ) {
 #ifdef NEW_LOGGING
-                               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
+                               LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: "
                                        "TLS could not load client CA list (file: `%s',dir:`%s')\n",
                                        tls_opt_cacertfile ? tls_opt_cacertfile : "",
-                                       tls_opt_cacertdir ? tls_opt_cacertdir : "" ));
+                                       tls_opt_cacertdir ? tls_opt_cacertdir : "", 0 );
 #else
                                Debug( LDAP_DEBUG_ANY, "TLS: "
                                        "could not load client CA list (file:`%s',dir:`%s').\n",
@@ -256,8 +256,8 @@ ldap_pvt_tls_init_def_ctx( void )
                                tls_opt_keyfile, SSL_FILETYPE_PEM ) )
                {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
-                               "TLS could not use key file `%s'.\n", tls_opt_keyfile ));
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: "
+                               "TLS could not use key file `%s'.\n", tls_opt_keyfile, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "TLS: could not use key file `%s'.\n",
@@ -272,8 +272,9 @@ ldap_pvt_tls_init_def_ctx( void )
                                tls_opt_certfile, SSL_FILETYPE_PEM ) )
                {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
-                               "TLS could not use certificate `%s'.\n", tls_opt_certfile ));
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_init_def_ctx: "
+                               "TLS could not use certificate `%s'.\n", 
+                               tls_opt_certfile, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "TLS: could not use certificate `%s'.\n",
@@ -287,8 +288,9 @@ ldap_pvt_tls_init_def_ctx( void )
                        !SSL_CTX_check_private_key( tls_def_ctx ) )
                {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_init_def_ctx: "
-                               "TLS private key mismatch.\n" ));
+                       LDAP_LOG ( TRANSPORT, ERR, 
+                               "ldap_pvt_tls_init_def_ctx: TLS private key mismatch.\n", 
+                               0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "TLS: private key mismatch.\n",
@@ -341,6 +343,7 @@ get_ca_list( char * bundle, char * dir )
        if ( bundle ) {
                ca_list = SSL_load_client_CA_file( bundle );
        }
+#if defined(HAVE_DIRENT_H) || defined(dirent)
        if ( dir ) {
                DIR *dirp;
                struct dirent *d;
@@ -377,6 +380,7 @@ get_ca_list( char * bundle, char * dir )
                        ca_list = NULL;
                }
        }
+#endif
 done:
        return ca_list;
 }
@@ -397,8 +401,8 @@ alloc_handle( void *ctx_arg )
        ssl = SSL_new( ctx );
        if ( ssl == NULL ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "alloc_handle: "
-                       "TLS can't create ssl handle.\n" ));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "alloc_handle: TLS can't create ssl handle.\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,"TLS: can't create ssl handle.\n",0,0,0);
 #endif
@@ -739,8 +743,8 @@ ldap_int_tls_connect( LDAP *ld, LDAPConn *conn )
                }
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_int_tls_connect: "
-                       "TLS can't connect.\n" ));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "ldap_int_tls_connect: TLS can't connect.\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,"TLS: can't connect.\n",0,0,0);
 #endif
@@ -791,8 +795,8 @@ ldap_pvt_tls_accept( Sockbuf *sb, void *ctx_arg )
                if ( update_flags( sb, ssl, err )) return 1;
 
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_accept: "
-                       "TLS can't accept.\n" ));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "ldap_pvt_tls_accept: TLS can't accept.\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,"TLS: can't accept.\n",0,0,0 );
 #endif
@@ -929,8 +933,9 @@ ldap_pvt_tls_check_hostname( void *s, const char *name_in )
        x = tls_get_cert((SSL *)s);
        if (!x) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_check_hostname: "
-                       "TLS unable to get peer certificate.\n" ));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "ldap_pvt_tls_check_hostname: "
+                       "TLS unable to get peer certificate.\n" , 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                        "TLS: unable to get peer certificate.\n",
@@ -1006,8 +1011,9 @@ ldap_pvt_tls_check_hostname( void *s, const char *name_in )
                        buf, sizeof(buf)) == -1)
                {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_check_hostname: "
-                               "TLS unable to get common name from peer certificate.\n" ));
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_check_hostname: "
+                               "TLS unable to get common name from peer certificate.\n", 
+                               0, 0, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "TLS: unable to get common name from peer certificate.\n",
@@ -1016,9 +1022,9 @@ ldap_pvt_tls_check_hostname( void *s, const char *name_in )
 
                } else if (strcasecmp(name, buf)) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "ldap_pvt_tls_check_hostname: "
+                       LDAP_LOG ( TRANSPORT, ERR, "ldap_pvt_tls_check_hostname: "
                                "TLS hostname (%s) does not match "
-                               "common name in certificate (%s).\n", name, buf ));
+                               "common name in certificate (%s).\n", name, buf, 0 );
 #else
                        Debug( LDAP_DEBUG_ANY, "TLS: hostname (%s) does not match "
                                "common name in certificate (%s).\n", 
@@ -1344,8 +1350,8 @@ tls_info_cb( SSL *ssl, int where, int ret )
 
        if ( where & SSL_CB_LOOP ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_DETAIL1, "tls_info_cb: "
-                       "TLS trace: %s:%s\n", op, SSL_state_string_long( ssl ) ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, "tls_info_cb: "
+                       "TLS trace: %s:%s\n", op, SSL_state_string_long( ssl ), 0 );
 #else
                Debug( LDAP_DEBUG_TRACE,
                           "TLS trace: %s:%s\n",
@@ -1355,10 +1361,10 @@ tls_info_cb( SSL *ssl, int where, int ret )
        } else if ( where & SSL_CB_ALERT ) {
                op = ( where & SSL_CB_READ ) ? "read" : "write";
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_DETAIL1, "tls_info_cb: "
-                       "TLS trace: SSL3 alert %s:%s:%s\n", op,
-                          SSL_alert_type_string_long( ret ),
-                          SSL_alert_desc_string_long( ret) ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                       "tls_info_cb: TLS trace: SSL3 alert %s:%s:%s\n", 
+                       op, SSL_alert_type_string_long( ret ), 
+                       SSL_alert_desc_string_long( ret) );
 #else
                Debug( LDAP_DEBUG_TRACE,
                           "TLS trace: SSL3 alert %s:%s:%s\n",
@@ -1370,8 +1376,9 @@ tls_info_cb( SSL *ssl, int where, int ret )
        } else if ( where & SSL_CB_EXIT ) {
                if ( ret == 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "tls_info_cb: "
-                       "TLS trace: %s:failed in %s\n", op, SSL_state_string_long( ssl ) ));
+                       LDAP_LOG ( TRANSPORT, ERR, 
+                               "tls_info_cb: TLS trace: %s:failed in %s\n", 
+                               op, SSL_state_string_long( ssl ), 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                   "TLS trace: %s:failed in %s\n",
@@ -1379,8 +1386,9 @@ tls_info_cb( SSL *ssl, int where, int ret )
 #endif
                } else if ( ret < 0 ) {
 #ifdef NEW_LOGGING
-                       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "tls_info_cb: "
-                       "TLS trace: %s:error in %s\n", op, SSL_state_string_long( ssl ) ));
+                       LDAP_LOG ( TRANSPORT, ERR, 
+                               "tls_info_cb: TLS trace: %s:error in %s\n", 
+                               op, SSL_state_string_long( ssl ), 0 );
 #else
                        Debug( LDAP_DEBUG_TRACE,
                                   "TLS trace: %s:error in %s\n",
@@ -1415,13 +1423,15 @@ tls_verify_cb( int ok, X509_STORE_CTX *ctx )
        sname = X509_NAME_oneline( subject, NULL, 0 );
        iname = X509_NAME_oneline( issuer, NULL, 0 );
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "tls_verify_cb"
-               "TLS certificate verification: depth: %d, err: %d: "
-               "subject: %s, issuer: %s\n", errdepth, errnum, 
-               sname ? sname : "-unknown-", iname ? iname : "-unknown-" ));
+       LDAP_LOG( TRANSPORT, ERR,
+                  "TLS certificate verification: depth: %d, err: %d, subject: %s,",
+                  errdepth, errnum,
+                  sname ? sname : "-unknown-" );
+       LDAP_LOG( TRANSPORT, ERR, " issuer: %s\n", iname ? iname : "-unknown-", 0, 0 );
        if ( !ok ) {
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, "TLS certificate verification: Error, %s\n",
-                       X509_verify_cert_error_string(errnum)));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "TLS certificate verification: Error, %s\n",
+                       X509_verify_cert_error_string(errnum), 0, 0 );
        }
 #else
        Debug( LDAP_DEBUG_TRACE,
@@ -1461,9 +1471,9 @@ tls_report_error( void )
 
        while ( ( l = ERR_get_error_line( &file, &line ) ) != 0 ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, 
+               LDAP_LOG ( TRANSPORT, ERR, 
                        "tls_report_error: TLS %s %s:%d\n", 
-                       ERR_error_string( l, buf ), file, line ));
+                       ERR_error_string( l, buf ), file, line );
 #else
                Debug( LDAP_DEBUG_ANY, "TLS: %s %s:%d\n",
                   ERR_error_string( l, buf ), file, line );
@@ -1482,9 +1492,9 @@ tls_tmp_rsa_cb( SSL *ssl, int is_export, int key_length )
 
        if ( !tmp_rsa ) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_ERR, 
-                       "tls_tmp_rsa_cb: TLS Failed to generate temporary %d-bit %s RSA key\n", 
-                       key_length, is_export ? "export" : "domestic" ));
+               LDAP_LOG ( TRANSPORT, ERR, 
+                       "tls_tmp_rsa_cb: TLS Failed to generate temporary %d-bit %s "
+                       "RSA key\n", key_length, is_export ? "export" : "domestic", 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                        "TLS: Failed to generate temporary %d-bit %s RSA key\n",
@@ -1518,9 +1528,9 @@ tls_seed_PRNG( const char *randfile )
 
        if (randfile == NULL) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_DETAIL1, 
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
                        "tls_seed_PRNG: TLS Use configuration file or "
-                       "$RANDFILE to define seed PRNG\n" ));
+                       "$RANDFILE to define seed PRNG\n", 0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                        "TLS: Use configuration file or $RANDFILE to define seed PRNG\n",
@@ -1533,8 +1543,9 @@ tls_seed_PRNG( const char *randfile )
 
        if (RAND_status() == 0) {
 #ifdef NEW_LOGGING
-               LDAP_LOG (( "tls", LDAP_LEVEL_DETAIL1, 
-                       "tls_seed_PRNG: TLS PRNG not been seeded with enough data\n" ));
+               LDAP_LOG ( TRANSPORT, DETAIL1, 
+                       "tls_seed_PRNG: TLS PRNG not been seeded with enough data\n", 
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
                        "TLS: PRNG not been seeded with enough data\n",
index 4474920bf7bc97d65ce867aa47b7bd012384e8dc..45b77f65281a421d0015b702471885f4ada0399f 100644 (file)
@@ -59,7 +59,7 @@ int
 ldap_unbind( LDAP *ld )
 {
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "unbind", LDAP_LEVEL_ENTRY, "ldap_unbind\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_unbind\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_unbind\n", 0, 0, 0 );
 #endif
@@ -181,7 +181,7 @@ ldap_send_unbind(
        BerElement      *ber;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "unbind", LDAP_LEVEL_ENTRY, "ldap_send_unbind\n" ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_send_unbind\n", 0, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_send_unbind\n", 0, 0, 0 );
 #endif
index e7985dae6b74079fc2314c8c9433fce455aab0fc..8bf8bd56d56f7a9d86cb7d1c5f897c48a86f49af 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "ldap-int.h"
 
-
 /* local functions */
 static const char* skip_url_prefix LDAP_P((
        const char *url,
@@ -446,7 +445,7 @@ ldap_url_parse_ext( LDAP_CONST char *url_in, LDAPURLDesc **ludpp )
         * the options and cause infinite recursion
         */
 #ifdef NEW_LOGGING
-       LDAP_LOG (( "url", LDAP_LEVEL_ENTRY, "ldap_url_parse_ext(%s)\n", url_in ));
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_url_parse_ext(%s)\n", url_in, 0, 0 );
 #else
        Debug( LDAP_DEBUG_TRACE, "ldap_url_parse_ext(%s)\n", url_in, 0, 0 );
 #endif
@@ -1138,12 +1137,14 @@ ldap_pvt_hex_unescape( char *s )
 
        for ( p = s; *s != '\0'; ++s ) {
                if ( *s == '%' ) {
-                       if ( *++s != '\0' ) {
-                               *p = ldap_int_unhex( *s ) << 4;
+                       if ( *++s == '\0' ) {
+                               break;
                        }
-                       if ( *++s != '\0' ) {
-                               *p++ += ldap_int_unhex( *s );
+                       *p = ldap_int_unhex( *s ) << 4;
+                       if ( *++s == '\0' ) {
+                               break;
                        }
+                       *p++ += ldap_int_unhex( *s );
                } else {
                        *p++ = *s;
                }