mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-25 09:09:54 -05:00
Add lber_pvt.h with prototypes of lber_pvt_log_print{,f}.
Ripple name change through -llber & -lldap. Update -lldif to use lber_pvt_log_printf() instead of Debug.
This commit is contained in:
parent
7eec267436
commit
321354ecff
6 changed files with 66 additions and 32 deletions
36
include/lber_pvt.h
Normal file
36
include/lber_pvt.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms are permitted only
|
||||
* as authorized by the OpenLDAP Public License. A copy of this
|
||||
* license is available at http://www.OpenLDAP.org/license.html or
|
||||
* in file LICENSE in the top-level directory of the distribution.
|
||||
*/
|
||||
/*
|
||||
* lber_pvt.h - Header for lber_pvt_ functions. These are meant to be used
|
||||
* by the OpenLDAP distribution only.
|
||||
*/
|
||||
|
||||
#ifndef _LBER_PVT_H
|
||||
#define _LBER_PVT_H 1
|
||||
|
||||
#include <lber.h>
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
/*
|
||||
* bprint.c
|
||||
*/
|
||||
extern BER_LOG_PRINT_FN lber_pvt_log_print;
|
||||
|
||||
LDAP_F int lber_pvt_log_printf LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
char *fmt,
|
||||
... ));
|
||||
|
||||
LDAP_END_DECL
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ lber_error_print( char *data )
|
|||
fflush( stderr );
|
||||
}
|
||||
|
||||
BER_LOG_PRINT_FN lber_log_print = lber_error_print;
|
||||
BER_LOG_PRINT_FN lber_pvt_log_print = lber_error_print;
|
||||
|
||||
/*
|
||||
* lber log
|
||||
|
|
@ -34,7 +34,7 @@ static int lber_log_check( int errlvl, int loglvl )
|
|||
return errlvl & loglvl ? 1 : 0;
|
||||
}
|
||||
|
||||
int lber_log_printf
|
||||
int lber_pvt_log_printf
|
||||
#ifdef HAVE_STDARG
|
||||
(int errlvl, int loglvl, char *fmt, ...)
|
||||
#else
|
||||
|
|
@ -74,7 +74,7 @@ va_dcl
|
|||
|
||||
va_end(ap);
|
||||
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -84,7 +84,7 @@ static int lber_log_puts(int errlvl, int loglvl, char *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ ber_bprint(char *data, int len )
|
|||
for ( ;; ) {
|
||||
if ( len < 1 ) {
|
||||
sprintf( buf, "\t%s\n", ( i == 0 ) ? "(end)" : out );
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ ber_bprint(char *data, int len )
|
|||
if ( i > BPLEN - 2 ) {
|
||||
char data[128 + BPLEN];
|
||||
sprintf( data, "\t%s\n", out );
|
||||
(*lber_log_print)(data);
|
||||
(*lber_pvt_log_print)(data);
|
||||
memset( out, 0, BPLEN );
|
||||
i = 0;
|
||||
continue;
|
||||
|
|
@ -168,7 +168,7 @@ ber_dump( BerElement *ber, int inout )
|
|||
(long) ber->ber_ptr,
|
||||
(long) ber->ber_end );
|
||||
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
|
||||
if ( inout == 1 ) {
|
||||
sprintf( buf, " current len %ld, contents:\n",
|
||||
|
|
@ -199,22 +199,22 @@ ber_sos_dump( Seqorset *sos )
|
|||
{
|
||||
char buf[132];
|
||||
|
||||
(*lber_log_print)( "*** sos dump ***\n" );
|
||||
(*lber_pvt_log_print)( "*** sos dump ***\n" );
|
||||
|
||||
while ( sos != NULLSEQORSET ) {
|
||||
sprintf( buf, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
|
||||
(long) sos->sos_clen, (long) sos->sos_first, (long) sos->sos_ptr );
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
|
||||
sprintf( buf, " current len %ld contents:\n",
|
||||
(long) (sos->sos_ptr - sos->sos_first) );
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
|
||||
ber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
|
||||
|
||||
sos = sos->sos_next;
|
||||
}
|
||||
|
||||
(*lber_log_print)( "*** end dump ***\n" );
|
||||
(*lber_pvt_log_print)( "*** end dump ***\n" );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include "lber.h"
|
||||
#include "ldap_log.h"
|
||||
#include "lber_pvt.h"
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ LDAP_BEGIN_DECL
|
|||
#define LBER_ITEM_SOCKBUF 2
|
||||
|
||||
extern int lber_int_debug;
|
||||
#define lber_log_printf lber_pvt_log_printf
|
||||
|
||||
struct berelement {
|
||||
short ber_item_type; /* always LBER_ITEM_BERELEMENT */
|
||||
|
|
@ -85,12 +87,6 @@ struct seqorset {
|
|||
/*
|
||||
* bprint.c
|
||||
*/
|
||||
LDAP_F int lber_log_printf LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
char *fmt,
|
||||
... ));
|
||||
|
||||
LDAP_F int lber_log_bprint LDAP_P((
|
||||
int errlvl,
|
||||
int loglvl,
|
||||
|
|
|
|||
|
|
@ -73,9 +73,7 @@ lber_set_option(
|
|||
return LBER_OPT_SUCCESS;
|
||||
|
||||
} else if(option == LBER_OPT_LOG_PRINT_FN) {
|
||||
extern BER_LOG_PRINT_FN lber_log_print;
|
||||
|
||||
lber_log_print = (BER_LOG_PRINT_FN) invalue;
|
||||
lber_pvt_log_print = (BER_LOG_PRINT_FN) invalue;
|
||||
return LBER_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#include "ldap-int.h"
|
||||
|
||||
extern BER_LOG_PRINT_FN lber_log_print;
|
||||
|
||||
/*
|
||||
* ldap log
|
||||
*/
|
||||
|
|
@ -74,7 +72,7 @@ va_dcl
|
|||
|
||||
va_end(ap);
|
||||
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -84,6 +82,6 @@ static int lber_log_puts(int errlvl, int loglvl, char *buf)
|
|||
return 0;
|
||||
}
|
||||
|
||||
(*lber_log_print)( buf );
|
||||
(*lber_pvt_log_print)( buf );
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@
|
|||
|
||||
int ldif_debug = 0;
|
||||
|
||||
#define ldap_debug ldif_debug
|
||||
#include "ldap_log.h"
|
||||
#include "lber_pvt.h"
|
||||
#include "ldif.h"
|
||||
|
||||
#define RIGHT2 0x03
|
||||
|
|
@ -70,7 +70,8 @@ ldif_parse_line(
|
|||
for ( s = line; *s && *s != ':'; s++ )
|
||||
; /* NULL */
|
||||
if ( *s == '\0' ) {
|
||||
Debug( LDAP_DEBUG_PARSE, "parse_line missing ':'\n", 0, 0, 0 );
|
||||
lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
"ldif_parse_line missing ':'\n");
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
|
@ -97,7 +98,8 @@ ldif_parse_line(
|
|||
|
||||
/* if no value is present, error out */
|
||||
if ( *s == '\0' ) {
|
||||
Debug( LDAP_DEBUG_PARSE, "parse_line missing value\n", 0,0,0 );
|
||||
lber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
|
||||
"ldif_parse_line missing value\n");
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
|
@ -116,9 +118,9 @@ ldif_parse_line(
|
|||
for ( i = 0; i < 4; i++ ) {
|
||||
if ( p[i] != '=' && (p[i] & 0x80 ||
|
||||
b642nib[ p[i] & 0x7f ] > 0x3f) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"invalid base 64 encoding char (%c) 0x%x\n",
|
||||
p[i], p[i], 0 );
|
||||
lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
"ldif_parse_line: invalid base 64 encoding char (%c) 0x%x\n",
|
||||
p[i], p[i] );
|
||||
return( -1 );
|
||||
}
|
||||
}
|
||||
|
|
@ -302,8 +304,12 @@ ldif_type_and_value( char *type, char *val, int vlen )
|
|||
int tlen;
|
||||
|
||||
tlen = strlen( type );
|
||||
if (( buf = (char *)malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 )) !=
|
||||
NULL ) {
|
||||
if (( buf = (char *) malloc( LDIF_SIZE_NEEDED( tlen, vlen ) + 1 ))
|
||||
== NULL )
|
||||
{
|
||||
lber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
|
||||
"ldif_type_and_value: malloc failed!" );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
p = buf;
|
||||
|
|
|
|||
Loading…
Reference in a new issue