Commit cbb6441c authored by Howard Chu's avatar Howard Chu
Browse files

ITS#8726 check newly registered loglevels immediately

See if they were requested as soon as they are successfully registered.
parent bb6844e2
......@@ -3717,6 +3717,7 @@ slap_loglevel_get( struct berval *s, int *l )
} else {
*l = i;
slap_check_unknown_level( s->bv_val, i );
}
return rc;
......
......@@ -227,6 +227,9 @@ parse_syslog_level( const char *arg, int *levelp )
}
#endif /* LDAP_DEBUG && LDAP_SYSLOG */
static char **debug_unknowns;
static char **syslog_unknowns;
int
parse_debug_unknowns( char **unknowns, int *levelp )
{
......@@ -303,6 +306,29 @@ parse_debug_level( const char *arg, int *levelp, char ***unknowns )
return 0;
}
void slap_check_unknown_level( char *levelstr, int level )
{
int i;
if ( debug_unknowns ) {
for ( i = 0; debug_unknowns[ i ]; i++ ) {
if ( !strcasecmp( debug_unknowns[ i ], levelstr )) {
slap_debug |= level;
break;
}
}
}
if ( syslog_unknowns ) {
for ( i = 0; syslog_unknowns[ i ]; i++ ) {
if ( !strcasecmp( syslog_unknowns[ i ], levelstr )) {
ldap_syslog |= level;
break;
}
}
}
}
static void
usage( char *name )
{
......@@ -351,6 +377,7 @@ usage( char *name )
);
}
#ifdef HAVE_NT_SERVICE_MANAGER
void WINAPI ServiceMain( DWORD argc, LPTSTR *argv )
#else
......@@ -385,9 +412,6 @@ int main( int argc, char **argv )
struct sync_cookie *scp = NULL;
struct sync_cookie *scp_entry = NULL;
char **debug_unknowns = NULL;
char **syslog_unknowns = NULL;
char *serverNamePrefix = "";
size_t l;
......
......@@ -1249,6 +1249,8 @@ LDAP_SLAPD_F (int)
parse_syslog_user LDAP_P(( const char *arg, int *syslogUser ));
LDAP_SLAPD_F (int)
parse_debug_unknowns LDAP_P(( char **unknowns, int *levelp ));
LDAP_SLAPD_F (void)
slap_check_unknown_level LDAP_P(( char *levelstr, int level ));
/*
* matchedValues.c
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment