ITS#8726 check newly registered loglevels immediately

See if they were requested as soon as they are successfully registered.
This commit is contained in:
Howard Chu 2021-03-21 16:36:30 +00:00
parent bb6844e296
commit cbb6441c30
3 changed files with 30 additions and 3 deletions

View File

@ -3717,6 +3717,7 @@ slap_loglevel_get( struct berval *s, int *l )
} else { } else {
*l = i; *l = i;
slap_check_unknown_level( s->bv_val, i );
} }
return rc; return rc;

View File

@ -227,6 +227,9 @@ parse_syslog_level( const char *arg, int *levelp )
} }
#endif /* LDAP_DEBUG && LDAP_SYSLOG */ #endif /* LDAP_DEBUG && LDAP_SYSLOG */
static char **debug_unknowns;
static char **syslog_unknowns;
int int
parse_debug_unknowns( char **unknowns, int *levelp ) parse_debug_unknowns( char **unknowns, int *levelp )
{ {
@ -303,6 +306,29 @@ parse_debug_level( const char *arg, int *levelp, char ***unknowns )
return 0; 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 static void
usage( char *name ) usage( char *name )
{ {
@ -351,6 +377,7 @@ usage( char *name )
); );
} }
#ifdef HAVE_NT_SERVICE_MANAGER #ifdef HAVE_NT_SERVICE_MANAGER
void WINAPI ServiceMain( DWORD argc, LPTSTR *argv ) void WINAPI ServiceMain( DWORD argc, LPTSTR *argv )
#else #else
@ -385,9 +412,6 @@ int main( int argc, char **argv )
struct sync_cookie *scp = NULL; struct sync_cookie *scp = NULL;
struct sync_cookie *scp_entry = NULL; struct sync_cookie *scp_entry = NULL;
char **debug_unknowns = NULL;
char **syslog_unknowns = NULL;
char *serverNamePrefix = ""; char *serverNamePrefix = "";
size_t l; size_t l;

View File

@ -1249,6 +1249,8 @@ LDAP_SLAPD_F (int)
parse_syslog_user LDAP_P(( const char *arg, int *syslogUser )); parse_syslog_user LDAP_P(( const char *arg, int *syslogUser ));
LDAP_SLAPD_F (int) LDAP_SLAPD_F (int)
parse_debug_unknowns LDAP_P(( char **unknowns, int *levelp )); 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 * matchedValues.c