mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
revert previous commit(s); clarify usage of "-s" in slapd(8).
This commit is contained in:
parent
059257aeaf
commit
3517bdf260
@ -86,6 +86,10 @@ will not fork or disassociate from the invoking terminal. Some general
|
||||
operation and status messages are printed for any value of \fIdebug\-level\fP.
|
||||
\fIdebug\-level\fP is taken as a bit string, with each bit corresponding to a
|
||||
different kind of debugging information. See <ldap.h> for details.
|
||||
Comma-separated arrays of friendly names can be specified to select
|
||||
debugging output of the corresponding debugging information.
|
||||
All the names recognized by the \fIloglevel\fP directive
|
||||
described in \fBslapd.conf\fP(5) are supported.
|
||||
Remember that if you turn on packet logging, packets containing bind passwords
|
||||
will be output, so if you redirect the log to a logfile, that file should
|
||||
be read-protected.
|
||||
@ -96,16 +100,11 @@ This option tells
|
||||
at what level debugging statements should be logged to the
|
||||
.BR syslog (8)
|
||||
facility.
|
||||
The value can be any of
|
||||
"EMERG",
|
||||
"ALERT",
|
||||
"CRIT",
|
||||
"ERR",
|
||||
"WARNING",
|
||||
"NOTICE",
|
||||
"INFO" or
|
||||
"DEBUG",
|
||||
defaulting to "DEBUG".
|
||||
The value "syslog\-level" can be set to any value or combination
|
||||
allowed by the "-d" switch.
|
||||
Slapd logs all messages selected by "syslog\-level"
|
||||
at the syslog(3) severity level "DEBUG",
|
||||
on the unit specified with "-l".
|
||||
.TP
|
||||
.BI \-n " service\-name"
|
||||
Specifies the service name for logging and other purposes. Defaults
|
||||
@ -128,6 +127,7 @@ However, this option is only permitted on systems that support
|
||||
local users with the
|
||||
.BR syslog (8)
|
||||
facility.
|
||||
Logging to syslog(8) occurs at the "DEBUG" severity level.
|
||||
.TP
|
||||
.BI \-f " slapd\-config\-file"
|
||||
Specifies the slapd configuration file. The default is
|
||||
|
@ -185,6 +185,91 @@ struct option_helper {
|
||||
{ BER_BVNULL, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
/* (yet) unused */
|
||||
#if 0
|
||||
static int
|
||||
parse_syslog_level( const char *arg )
|
||||
{
|
||||
if ( !isdigit( arg[ 0 ] ) ) {
|
||||
slap_verbmasks str2syslog_level[] = {
|
||||
{ BER_BVC( "EMERG" ), LOG_EMERG },
|
||||
{ BER_BVC( "ALERT" ), LOG_ALERT },
|
||||
{ BER_BVC( "CRIT" ), LOG_CRIT },
|
||||
{ BER_BVC( "ERR" ), LOG_ERR },
|
||||
{ BER_BVC( "WARNING" ), LOG_WARNING },
|
||||
{ BER_BVC( "NOTICE" ), LOG_NOTICE },
|
||||
{ BER_BVC( "INFO" ), LOG_INFO },
|
||||
{ BER_BVC( "DEBUG" ), LOG_DEBUG },
|
||||
{ BER_BVNULL, 0 }
|
||||
};
|
||||
int i = verb_to_mask( arg, str2syslog_level );
|
||||
if ( BER_BVISNULL( &str2syslog_level[ i ].word ) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unknown syslog level \"%s\".\n",
|
||||
arg, 0, 0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
ldap_syslog_level = str2syslog_level[ i ].mask;
|
||||
|
||||
} else if ( lutil_atoi( &ldap_syslog_level, arg ) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unable to parse syslog level \"%s\".\n",
|
||||
arg, 0, 0 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
parse_debug_level( const char *arg, int *levelp )
|
||||
{
|
||||
int level;
|
||||
|
||||
if ( arg != NULL && arg[ 0 ] != '-' && !isdigit( arg[ 0 ] ) )
|
||||
{
|
||||
int i, goterr = 0;
|
||||
char **levels;
|
||||
|
||||
levels = ldap_str2charray( arg, "," );
|
||||
|
||||
for ( i = 0; levels[ i ] != NULL; i++ ) {
|
||||
level = 0;
|
||||
|
||||
if ( str2loglevel( levels[ i ], &level ) ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", levels[ i ] );
|
||||
goterr = 1;
|
||||
/* but keep parsing... */
|
||||
|
||||
} else {
|
||||
*levelp |= level;
|
||||
}
|
||||
}
|
||||
|
||||
ldap_charray_free( levels );
|
||||
|
||||
if ( goterr ) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( lutil_atoix( &level, arg, 0 ) != 0 ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", arg );
|
||||
return 1;
|
||||
}
|
||||
|
||||
*levelp |= level;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
usage( char *name )
|
||||
{
|
||||
@ -395,46 +480,13 @@ int main( int argc, char **argv )
|
||||
int level = 0;
|
||||
|
||||
no_detach = 1;
|
||||
#ifdef LDAP_DEBUG
|
||||
if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
|
||||
{
|
||||
int i, goterr = 0;
|
||||
char **levels;
|
||||
|
||||
levels = ldap_str2charray( optarg, "," );
|
||||
|
||||
for ( i = 0; levels[ i ] != NULL; i++ ) {
|
||||
level = 0;
|
||||
|
||||
if ( str2loglevel( levels[ i ], &level ) ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", levels[ i ] );
|
||||
goterr = 1;
|
||||
/* but keep parsing... */
|
||||
|
||||
} else {
|
||||
slap_debug |= level;
|
||||
}
|
||||
}
|
||||
|
||||
ldap_charray_free( levels );
|
||||
|
||||
if ( goterr ) {
|
||||
goto destroy;
|
||||
}
|
||||
|
||||
} else {
|
||||
if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", optarg );
|
||||
goto destroy;
|
||||
}
|
||||
slap_debug |= level;
|
||||
if ( parse_debug_level( optarg, &level ) ) {
|
||||
goto destroy;
|
||||
}
|
||||
#ifdef LDAP_DEBUG
|
||||
slap_debug |= level;
|
||||
#else
|
||||
if ( lutil_atoi( &level, optarg ) != 0 || level != 0 )
|
||||
if ( level != 0 )
|
||||
fputs( "must compile with LDAP_DEBUG for debugging\n",
|
||||
stderr );
|
||||
#endif
|
||||
@ -483,32 +535,7 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
case 's': /* set syslog level */
|
||||
if ( !isdigit( optarg[ 0 ] ) ) {
|
||||
slap_verbmasks str2syslog_level[] = {
|
||||
{ BER_BVC( "EMERG" ), LOG_EMERG },
|
||||
{ BER_BVC( "ALERT" ), LOG_ALERT },
|
||||
{ BER_BVC( "CRIT" ), LOG_CRIT },
|
||||
{ BER_BVC( "ERR" ), LOG_ERR },
|
||||
{ BER_BVC( "WARNING" ), LOG_WARNING },
|
||||
{ BER_BVC( "NOTICE" ), LOG_NOTICE },
|
||||
{ BER_BVC( "INFO" ), LOG_INFO },
|
||||
{ BER_BVC( "DEBUG" ), LOG_DEBUG },
|
||||
{ BER_BVNULL, 0 }
|
||||
};
|
||||
int i = verb_to_mask( optarg, str2syslog_level );
|
||||
if ( BER_BVISNULL( &str2syslog_level[ i ].word ) ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unknown syslog level \"%s\".\n",
|
||||
optarg, 0, 0 );
|
||||
goto destroy;
|
||||
}
|
||||
|
||||
ldap_syslog_level = str2syslog_level[ i ].mask;
|
||||
|
||||
} else if ( lutil_atoi( &ldap_syslog_level, optarg ) != 0 ) {
|
||||
Debug( LDAP_DEBUG_ANY,
|
||||
"unable to parse syslog level \"%s\".\n",
|
||||
optarg, 0, 0 );
|
||||
if ( parse_debug_level( optarg, &ldap_syslog ) ) {
|
||||
goto destroy;
|
||||
}
|
||||
break;
|
||||
|
@ -1005,6 +1005,12 @@ LDAP_SLAPD_F (FILE *) lock_fopen LDAP_P(( const char *fname,
|
||||
const char *type, FILE **lfp ));
|
||||
LDAP_SLAPD_F (int) lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
|
||||
|
||||
/*
|
||||
* main.c
|
||||
*/
|
||||
LDAP_SLAPD_F (int)
|
||||
parse_debug_level LDAP_P(( const char *arg, int *levelp ));
|
||||
|
||||
/*
|
||||
* matchedValues.c
|
||||
*/
|
||||
|
@ -267,59 +267,19 @@ slap_tool_init(
|
||||
case 'd': { /* turn on debugging */
|
||||
int level = 0;
|
||||
|
||||
if ( parse_debug_level( optarg, &level ) ) {
|
||||
usage( tool, progname );
|
||||
}
|
||||
#ifdef LDAP_DEBUG
|
||||
if ( optarg != NULL && optarg[ 0 ] != '-' && !isdigit( optarg[ 0 ] ) )
|
||||
{
|
||||
int i, goterr = 0;
|
||||
char **levels;
|
||||
|
||||
levels = ldap_str2charray( optarg, "," );
|
||||
|
||||
for ( i = 0; levels[ i ] != NULL; i++ ) {
|
||||
level = 0;
|
||||
|
||||
if ( str2loglevel( levels[ i ], &level ) ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", levels[ i ] );
|
||||
goterr = 1;
|
||||
/* but keep parsing... */
|
||||
|
||||
} else {
|
||||
if ( level != 0 ) {
|
||||
slap_debug |= level;
|
||||
|
||||
} else {
|
||||
/* allow to reset log level */
|
||||
slap_debug = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ldap_charray_free( levels );
|
||||
|
||||
if ( goterr ) {
|
||||
usage( tool, progname );
|
||||
}
|
||||
if ( level == 0 ) {
|
||||
/* allow to reset log level */
|
||||
slap_debug = 0;
|
||||
|
||||
} else {
|
||||
if ( lutil_atoix( &level, optarg, 0 ) != 0 ) {
|
||||
fprintf( stderr,
|
||||
"unrecognized log level "
|
||||
"\"%s\"\n", optarg );
|
||||
usage( tool, progname );
|
||||
}
|
||||
|
||||
if ( level != 0 ) {
|
||||
slap_debug |= level;
|
||||
|
||||
} else {
|
||||
/* allow to reset log level */
|
||||
slap_debug = 0;
|
||||
}
|
||||
slap_debug |= level;
|
||||
}
|
||||
#else
|
||||
if ( lutil_atoi( &level, optarg ) != 0 || level != 0 )
|
||||
if ( level != 0 )
|
||||
fputs( "must compile with LDAP_DEBUG for debugging\n",
|
||||
stderr );
|
||||
#endif
|
||||
|
@ -137,7 +137,7 @@ DIFF="diff -i"
|
||||
CMP="diff -i"
|
||||
BCMP="diff -iB"
|
||||
CMPOUT=/dev/null
|
||||
SLAPD="../servers/slapd/slapd -sDEBUG"
|
||||
SLAPD="../servers/slapd/slapd -s0"
|
||||
SLURPD=../servers/slurpd/slurpd
|
||||
LDAPPASSWD="$CLIENTDIR/ldappasswd $TOOLARGS"
|
||||
LDAPSASLSEARCH="$CLIENTDIR/ldapsearch $TOOLPROTO $LDAP_TOOLARGS -LLL"
|
||||
|
Loading…
Reference in New Issue
Block a user