Commit d611a4b4 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

unifdef -UNEW_LOGGING

parent e0a9ea2f
......@@ -229,81 +229,6 @@ ber_bprint(
(*ber_pvt_log_print)( line );
}
#ifdef NEW_LOGGING
int ber_output_dump(
const char *subsys,
int level,
BerElement *ber,
int inout )
{
static const char hexdig[] = "0123456789abcdef";
char buf[132];
ber_len_t len;
char line[ BP_LEN ];
ber_len_t i;
char *data = ber->ber_ptr;
if ( inout == 1 ) {
len = ber_pvt_ber_remaining(ber);
} else {
len = ber_pvt_ber_write(ber);
}
sprintf( buf, "ber_dump: buf=0x%08lx ptr=0x%08lx end=0x%08lx len=%ld\n",
(long) ber->ber_buf,
(long) ber->ber_ptr,
(long) ber->ber_end,
(long) len );
(void) ber_pvt_log_output( subsys, level, "%s", buf );
#define BP_OFFSET 9
#define BP_GRAPH 60
#define BP_LEN 80
assert( data != NULL );
/* in case len is zero */
line[0] = '\n';
line[1] = '\0';
for ( i = 0 ; i < len ; i++ ) {
int n = i % 16;
unsigned off;
if( !n ) {
if( i ) {
(void) ber_pvt_log_output( subsys, level, "%s", line );
}
memset( line, ' ', sizeof(line)-2 );
line[sizeof(line)-2] = '\n';
line[sizeof(line)-1] = '\0';
off = i % 0x0ffffU;
line[2] = hexdig[0x0f & (off >> 12)];
line[3] = hexdig[0x0f & (off >> 8)];
line[4] = hexdig[0x0f & (off >> 4)];
line[5] = hexdig[0x0f & off ];
line[6] = ':';
}
off = BP_OFFSET + n*3 + ((n >= 8)?1:0);
line[off] = hexdig[ 0x0f & ( data[i] >> 4 ) ];
line[off+1] = hexdig[ 0x0f & data[i] ];
off = BP_GRAPH + n + ((n >= 8)?1:0);
if ( isprint( (unsigned char) data[i] )) {
line[BP_GRAPH + n] = data[i];
} else {
line[BP_GRAPH + n] = '.';
}
}
return ber_pvt_log_output( subsys, level, "%s", line );
}
#endif
int
ber_log_dump(
......
......@@ -669,17 +669,9 @@ ber_scanf ( BerElement *ber,
fmt_reset = fmt;
#ifdef NEW_LOGGING
LDAP_LOG( BER, ENTRY, "ber_scanf fmt (%s) ber:\n", fmt, 0, 0 );
if ( LDAP_LOGS_TEST(BER, DETAIL2 )) {
BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 ));
}
#else
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
"ber_scanf fmt (%s) ber:\n", fmt );
ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
#endif
for ( rc = 0; *fmt && rc != LBER_DEFAULT; fmt++ ) {
/* When this is modified, remember to update
......@@ -824,13 +816,8 @@ ber_scanf ( BerElement *ber,
default:
if( ber->ber_debug ) {
#ifdef NEW_LOGGING
LDAP_LOG( BER, ERR,
"ber_scanf: unknown fmt %c\n", *fmt, 0, 0 );
#else
ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
"ber_scanf: unknown fmt %c\n", *fmt );
#endif
}
rc = LBER_DEFAULT;
break;
......
......@@ -818,13 +818,8 @@ ber_printf( BerElement *ber, LDAP_CONST char *fmt, ... )
default:
if( ber->ber_debug ) {
#ifdef NEW_LOGGING
LDAP_LOG( BER, ERR,
"ber_printf: unknown fmt %c\n", *fmt, 0, 0 );
#else
ber_log_printf( LDAP_DEBUG_ANY, ber->ber_debug,
"ber_printf: unknown fmt %c\n", *fmt );
#endif
}
rc = -1;
break;
......
......@@ -216,23 +216,12 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
towrite = ber->ber_ptr - ber->ber_rwptr;
if ( sb->sb_debug ) {
#ifdef NEW_LOGGING
LDAP_LOG( BER, DETAIL1,
"ber_flush: %ld bytes to sd %ld%s\n",
towrite, (long)sb->sb_fd,
ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" );
if(LDAP_LOGS_TEST(BER, DETAIL2))
BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 ));
#else
ber_log_printf( LDAP_DEBUG_TRACE, sb->sb_debug,
"ber_flush: %ld bytes to sd %ld%s\n",
towrite, (long) sb->sb_fd,
ber->ber_rwptr != ber->ber_buf ? " (re-flush)" : "" );
ber_log_bprint( LDAP_DEBUG_PACKETS, sb->sb_debug,
ber->ber_rwptr, towrite );
#endif
}
while ( towrite > 0 ) {
......@@ -484,12 +473,8 @@ ber_get_next(
assert( SOCKBUF_VALID( sb ) );
assert( LBER_VALID( ber ) );
#ifdef NEW_LOGGING
LDAP_LOG( BER, ENTRY, "ber_get_next: enter\n", 0, 0, 0 );
#else
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
"ber_get_next\n" );
#endif
/*
* Any ber element looks like this: tag length contents.
......@@ -622,15 +607,9 @@ ber_get_next(
}
if ( sb->sb_max_incoming && ber->ber_len > sb->sb_max_incoming ) {
#ifdef NEW_LOGGING
LDAP_LOG( BER, ERR,
"ber_get_next: sockbuf_max_incoming exceeded "
"(%d > %d)\n", ber->ber_len, sb->sb_max_incoming, 0 );
#else
ber_log_printf( LDAP_DEBUG_CONNS, ber->ber_debug,
"ber_get_next: sockbuf_max_incoming exceeded "
"(%ld > %ld)\n", ber->ber_len, sb->sb_max_incoming );
#endif
errno = ERANGE;
return LBER_DEFAULT;
}
......@@ -691,18 +670,10 @@ done:
ber->ber_rwptr = NULL;
*len = ber->ber_len;
if ( ber->ber_debug ) {
#ifdef NEW_LOGGING
LDAP_LOG( BER, DETAIL1,
"ber_get_next: tag 0x%lx len %ld\n",
ber->ber_tag, ber->ber_len, 0 );
if(LDAP_LOGS_TEST(BER, DETAIL2))
BER_DUMP(( "liblber", LDAP_LEVEL_DETAIL2, ber, 1 ));
#else
ber_log_printf( LDAP_DEBUG_TRACE, ber->ber_debug,
"ber_get_next: tag 0x%lx len %ld contents:\n",
ber->ber_tag, ber->ber_len );
ber_log_dump( LDAP_DEBUG_BER, ber->ber_debug, ber, 1 );
#endif
}
return (ber->ber_tag);
}
......
......@@ -45,23 +45,6 @@ struct lber_options {
long lbo_meminuse;
};
#ifdef NEW_LOGGING
/*
# ifdef LDAP_DEBUG
# ifdef LDAP_LOG
# undef LDAP_LOG
# endif
# define LDAP_LOG(a) ber_pvt_log_output a
*/
# define BER_DUMP(a) ber_output_dump a
/*
# else
# define LDAP_LOG(a)
# define BER_DUMP(a)
# endif
*/
#endif
LBER_F( int ) ber_pvt_log_output(
const char *subsystem,
int level,
......@@ -142,15 +125,6 @@ LBER_F (void) ber_rewind LDAP_P(( BerElement * ));
*/
#define ber_log_printf ber_pvt_log_printf
#ifdef NEW_LOGGING
LBER_F( int )
ber_output_dump LDAP_P((
const char *subsys,
int level,
BerElement *ber,
int inout ));
#endif
LBER_F( int )
ber_log_bprint LDAP_P((
int errlvl,
......
......@@ -67,11 +67,7 @@ ldap_abandon_ext(
LDAPControl **cctrls )
{
int rc;
#ifdef NEW_LOGGING
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
/* check client controls */
#ifdef LDAP_R_COMPILE
......@@ -102,11 +98,7 @@ ldap_abandon_ext(
int
ldap_abandon( LDAP *ld, int msgid )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ARGS, "ldap_abandon %d\n", msgid, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_abandon %d\n", msgid, 0, 0 );
#endif
return ldap_abandon_ext( ld, msgid, NULL, NULL ) == LDAP_SUCCESS
? 0 : -1;
}
......@@ -126,12 +118,8 @@ do_abandon(
Sockbuf *sb;
LDAPRequest *lr;
#ifdef NEW_LOGGING
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 );
#endif
sendabandon = 1;
......
......@@ -110,11 +110,7 @@ ldap_add_ext(
int i, rc;
ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_add_ext\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_add_ext\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
assert( dn != NULL );
......
......@@ -70,11 +70,7 @@
int
ldap_bind( LDAP *ld, LDAP_CONST char *dn, LDAP_CONST char *passwd, int authmethod )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_bind\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_bind\n", 0, 0, 0 );
#endif
switch ( authmethod ) {
case LDAP_AUTH_SIMPLE:
......@@ -119,11 +115,7 @@ ldap_bind_s(
LDAP_CONST char *passwd,
int authmethod )
{
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_bind_s\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_bind_s\n", 0, 0, 0 );
#endif
switch ( authmethod ) {
case LDAP_AUTH_SIMPLE:
......
......@@ -65,11 +65,7 @@ ldap_compare_ext(
BerElement *ber;
ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_compare\n", 0, 0, 0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_compare\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......
......@@ -80,17 +80,10 @@ int ldap_int_sasl_init( void )
sprintf( version, "%u.%d.%d", (unsigned)rc >> 24, (rc >> 16) & 0xff,
rc & 0xffff );
#ifdef NEW_LOGGING
LDAP_LOG( TRANSPORT, INFO,
"ldap_int_sasl_init: SASL library version mismatch:"
" expected " SASL_VERSION_STRING ","
" got %s\n", version, 0, 0 );
#else
Debug( LDAP_DEBUG_ANY,
"ldap_int_sasl_init: SASL library version mismatch:"
" expected " SASL_VERSION_STRING ","
" got %s\n", version, 0, 0 );
#endif
return -1;
}
}
......@@ -416,12 +409,8 @@ Sockbuf_IO ldap_pvt_sockbuf_io_sasl = {
int ldap_pvt_sasl_install( Sockbuf *sb, void *ctx_arg )
{
#ifdef NEW_LOGGING
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 );
#endif
/* don't install the stuff unless security has been negotiated */
......@@ -526,13 +515,8 @@ ldap_int_sasl_open(
return ld->ld_errno;
}
#ifdef NEW_LOGGING
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 );
#endif
lc->lconn_sasl_authctx = ctx;
......@@ -580,13 +564,8 @@ ldap_int_sasl_bind(
ber_socket_t sd;
void *ssl;
#ifdef NEW_LOGGING
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 );
#endif
/* do a quick !LDAPv3 check... ldap_sasl_bind will do the rest. */
if (ld->ld_version < LDAP_VERSION3) {
......@@ -721,15 +700,9 @@ ldap_int_sasl_bind(
if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) {
if( scred && scred->bv_len ) {
/* and server provided us with data? */
#ifdef NEW_LOGGING
LDAP_LOG ( TRANSPORT, DETAIL1,
"ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
rc, saslrc, scred->bv_len );
#else
Debug( LDAP_DEBUG_TRACE,
"ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
rc, saslrc, scred->bv_len );
#endif
ber_bvfree( scred );
}
rc = ld->ld_errno;
......@@ -740,15 +713,9 @@ ldap_int_sasl_bind(
/* we're done, no need to step */
if( scred && scred->bv_len ) {
/* but server provided us with data! */
#ifdef NEW_LOGGING
LDAP_LOG ( TRANSPORT, DETAIL1,
"ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
rc, saslrc, scred->bv_len );
#else
Debug( LDAP_DEBUG_TRACE,
"ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
rc, saslrc, scred->bv_len );
#endif
ber_bvfree( scred );
rc = ld->ld_errno = LDAP_LOCAL_ERROR;
goto done;
......@@ -764,13 +731,8 @@ ldap_int_sasl_bind(
(SASL_CONST char **)&ccred.bv_val,
&credlen );
#ifdef NEW_LOGGING
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 );
#endif
if( saslrc == SASL_INTERACT ) {
int res;
......
......@@ -59,11 +59,7 @@ ldap_delete_ext(
BerElement *ber;
ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_delete_ext\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_delete_ext\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......@@ -151,11 +147,7 @@ ldap_delete( LDAP *ld, LDAP_CONST char *dn )
* DelRequet ::= DistinguishedName,
*/
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_delete\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_delete\n", 0, 0, 0 );
#endif
return ldap_delete_ext( ld, dn, NULL, NULL, &msgid ) == LDAP_SUCCESS
? msgid : -1 ;
......
......@@ -143,11 +143,7 @@ ldap_err2string( int err )
{
const struct ldaperror *e;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_err2string\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_err2string\n", 0, 0, 0 );
#endif
e = ldap_int_error( err );
......@@ -160,11 +156,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str )
{
int i;
const struct ldaperror *e;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_perror\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......@@ -247,11 +239,7 @@ ldap_parse_result(
ber_tag_t tag;
BerElement *ber;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_result\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_parse_result\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......
......@@ -57,11 +57,7 @@ ldap_extended_operation(
int rc;
ber_int_t id;
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_extended_operation\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_extended_operation\n", 0, 0, 0 );
#endif
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......@@ -131,11 +127,7 @@ ldap_extended_operation_s(
int msgid;
LDAPMessage *res;
#ifdef NEW_LOGGING
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
assert( ld != NULL );
assert( LDAP_VALID( ld ) );
......@@ -187,11 +179,7 @@ ldap_parse_extended_result (
assert( LDAP_VALID( ld ) );
assert( res != NULL );
#ifdef NEW_LOGGING
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
if( ld->ld_version < LDAP_VERSION3 ) {
ld->ld_errno = LDAP_NOT_SUPPORTED;
......@@ -314,11 +302,7 @@ ldap_parse_intermediate (
assert( LDAP_VALID( ld ) );
assert( res != NULL );
#ifdef NEW_LOGGING
LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_intermediate\n", 0,0,0 );
#else
Debug( LDAP_DEBUG_TRACE, "ldap_parse_intermediate\n", 0, 0, 0 );
#endif
if( ld->ld_version < LDAP_VERSION3 ) {
ld->ld_errno = LDAP_NOT_SUPPORTED;
......
......@@ -366,11 +366,7 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
* Note: tags in a choice are always explicit
*/
#ifdef NEW_LOGGING
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
freeme = LDAP_STRDUP( str_in );
if( freeme == NULL ) return LDAP_NO_MEMORY;
......@@ -388,12 +384,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
switch ( *str ) {
case '&':
#ifdef NEW_LOGGING
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 );
#endif
str = put_complex_filter( ber, str,
LDAP_FILTER_AND, 0 );
......@@ -406,12 +398,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
break;
case '|':
#ifdef NEW_LOGGING
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 );
#endif
str = put_complex_filter( ber, str,
LDAP_FILTER_OR, 0 );
......@@ -424,12 +412,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
break;
case '!':
#ifdef NEW_LOGGING
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 );
#endif
str = put_complex_filter( ber, str,
LDAP_FILTER_NOT, 0 );
......@@ -442,12 +426,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
break;
default:
#ifdef NEW_LOGGING
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 );
#endif
balance = 1;
escape = 0;
......@@ -492,12 +472,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
break;
case /*'('*/ ')':
#ifdef NEW_LOGGING
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 );
#endif
if ( ber_printf( ber, /*"["*/ "]" ) == -1 ) {
rc = -1;
goto done;
......@@ -511,12 +487,8 @@ ldap_pvt_put_filter( BerElement *ber, const char *str_in )
break;
default: /* assume it's a simple type=value filter */
#ifdef NEW_LOGGING
LDAP_LOG ( FILTER, DETAIL1, "ldap_pvt_put_filter: default\n", 0,0,0 );
#else
<