]> git.sur5r.net Git - openldap/commitdiff
don't "overflow" debug levels (ITS#6324)
authorPierangelo Masarati <ando@openldap.org>
Tue, 6 Oct 2009 22:03:15 +0000 (22:03 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 6 Oct 2009 22:03:15 +0000 (22:03 +0000)
include/ldap_log.h
servers/slapd/bconfig.c
servers/slapd/main.c

index 9c1b2c7be39d19245067e2881a385ff5b63d27fc..a1e1f84dd0dfb64bdc51d7e0f07b47959f771481 100644 (file)
@@ -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
index c03c23afdaa7ee5b52059cd6d387d681ba4e3ce3..ae51278ecfe7cb0e7aa43c1e4d1931d56619d7f4 100644 (file)
@@ -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 },
index 14fadd6b1acd4741a254d5baebe4ac91c57e23b3..2fc052369b640d1a44e4c9b8223b97f07027689b 100644 (file)
@@ -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 );