From: Pierangelo Masarati Date: Tue, 6 Oct 2009 22:03:15 +0000 (+0000) Subject: don't "overflow" debug levels (ITS#6324) X-Git-Tag: ACLCHECK_0~195 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=16d3ad01c0d460816bed2589d73c53c0d3b9820f;p=openldap don't "overflow" debug levels (ITS#6324) --- diff --git a/include/ldap_log.h b/include/ldap_log.h index 9c1b2c7be3..a1e1f84dd0 100644 --- a/include/ldap_log.h +++ b/include/ldap_log.h @@ -123,7 +123,7 @@ LDAP_BEGIN_DECL #define LDAP_DEBUG_SYNC 0x4000 #define LDAP_DEBUG_NONE 0x8000 -#define LDAP_DEBUG_ANY -1 +#define LDAP_DEBUG_ANY ((unsigned long)-1) /* debugging stuff */ #ifdef LDAP_DEBUG diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index c03c23afda..ae51278ecf 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -3051,7 +3051,7 @@ static int loglevel_init( void ) { slap_verbmasks lo[] = { - { BER_BVC("Any"), -1 }, + { BER_BVC("Any"), LDAP_DEBUG_ANY }, { BER_BVC("Trace"), LDAP_DEBUG_TRACE }, { BER_BVC("Packets"), LDAP_DEBUG_PACKETS }, { BER_BVC("Args"), LDAP_DEBUG_ARGS }, diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 14fadd6b1a..2fc052369b 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -270,7 +270,18 @@ parse_debug_level( const char *arg, int *levelp, char ***unknowns ) ldap_charray_free( levels ); } else { - if ( lutil_atoix( &level, arg, 0 ) != 0 ) { + int rc; + + if ( arg[0] == '-' ) { + rc = lutil_atoix( &level, arg, 0 ); + } else { + unsigned ulevel; + + rc = lutil_atoux( &ulevel, arg, 0 ); + level = (int)ulevel; + } + + if ( rc ) { fprintf( stderr, "unrecognized log level " "\"%s\"\n", arg );