} else {
#ifdef LDAP_DEBUG
- if ( ldap_debug & LDAP_DEBUG_ACL ) {
+ if ( slap_debug & LDAP_DEBUG_ACL ) {
print_acl( be, a );
}
#endif
if ( slapMode != SLAP_UNDEFINED_MODE ) {
/* Make sure we write something to stderr */
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s init: init called twice (old=%d, new=%d)\n",
name, slapMode, mode );
#ifdef SLAPD_MODULES
if ( module_init() != 0 ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: module_init failed\n",
name, 0, 0 );
#endif
if ( slap_schema_init( ) != 0 ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: slap_schema_init failed\n",
name, 0, 0 );
break;
default:
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s init: undefined mode (%d).\n", name, mode, 0 );
}
if ( slap_controls_init( ) != 0 ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: slap_controls_init failed\n",
name, 0, 0 );
#endif
if ( frontend_init() ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: frontend_init failed\n",
name, 0, 0 );
}
if ( overlay_init() ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: overlay_init failed\n",
name, 0, 0 );
}
if ( glue_sub_init() ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: glue/subordinate init failed\n",
name, 0, 0 );
}
if ( acl_init() ) {
- ldap_debug |= 1;
+ slap_debug |= LDAP_DEBUG_NONE;
Debug( LDAP_DEBUG_ANY,
"%s: acl_init failed\n",
name, 0, 0 );
#ifdef LDAP_DEBUG
if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
{
- int level;
+ int level, i, goterr = 0;
+ char **levels;
- if ( str2loglevel( optarg, &level ) ) {
- fprintf( stderr,
- "unrecognized log level "
- "\"%s\"\n", optarg );
+ levels = ldap_str2charray( optarg, "," );
+
+ for ( i = 0; levels[ i ] != NULL; i++ ) {
+ if ( str2loglevel( levels[ i ], &level ) ) {
+ fprintf( stderr,
+ "unrecognized log level "
+ "\"%s\"\n", levels[ i ] );
+ goterr = 1;
+
+ } else {
+ slap_debug |= level;
+ }
+ }
+
+ ldap_charray_free( levels );
+
+ if ( goterr ) {
goto destroy;
}
- slap_debug |= level;
} else {
int level;
#ifdef LDAP_DEBUG
/* tools default to "none", so that at least LDAP_DEBUG_ANY
* messages show up; use -d 0 to reset */
- ldap_debug = LDAP_DEBUG_NONE;
+ slap_debug = LDAP_DEBUG_NONE;
#endif
#ifdef CSRIMALLOC
break;
case 'd': /* turn on debugging */
- {
#ifdef LDAP_DEBUG
- int level;
-
if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
{
- if ( str2loglevel( optarg, &level ) ) {
+ int level, i, goterr = 0;
+ char **levels;
+
+ levels = ldap_str2charray( optarg, "," );
+
+ for ( i = 0; levels[ i ] != NULL; i++ ) {
+ if ( str2loglevel( levels[ i ], &level ) ) {
+ fprintf( stderr,
+ "unrecognized log level "
+ "\"%s\"\n", levels[ i ] );
+ goterr = 1;
+
+ } else {
+ if ( level ) {
+ slap_debug |= level;
+ } else {
+ /* allow to reset log level */
+ slap_debug = 0;
+ }
+ }
+ }
+
+ ldap_charray_free( levels );
+
+ if ( goterr ) {
+ usage( tool, progname );
+ }
+
+ } else {
+ int level;
+
+ if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
fprintf( stderr,
"unrecognized log level "
"\"%s\"\n", optarg );
- exit( EXIT_FAILURE );
+ usage( tool, progname );
}
- } else if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
- fprintf( stderr,
- "unrecognized log level "
- "\"%s\"\n", optarg );
- exit( EXIT_FAILURE );
- }
-
- if ( level ) {
- ldap_debug |= level;
- } else {
- /* allow to reset log level */
- ldap_debug = 0;
+ if ( level ) {
+ slap_debug |= level;
+ } else {
+ /* allow to reset log level */
+ slap_debug = 0;
+ }
}
#else
if ( lutil_atoi( &level, optarg ) != 0 || level != 0 )
fputs( "must compile with LDAP_DEBUG for debugging\n",
stderr );
#endif
- } break;
+ break;
case 'D':
ber_str2bv( optarg, 0, 1, &authcDN );