Fix for !(LDAP_DEBUG && LDAP_SYSLOG)

This commit is contained in:
Hallvard Furuseth 2007-05-11 23:04:33 +00:00
parent e509d3ed9a
commit dfc10014b1
2 changed files with 11 additions and 9 deletions

View File

@ -305,7 +305,7 @@ usage( char *name )
"\t-g group\tGroup (id or name) to run as\n" "\t-g group\tGroup (id or name) to run as\n"
#endif #endif
"\t-h URLs\t\tList of URLs to serve\n" "\t-h URLs\t\tList of URLs to serve\n"
#ifdef LOG_LOCAL4 #ifdef SLAP_DEFAULT_SYSLOG_USER
"\t-l facility\tSyslog facility (default: LOCAL4)\n" "\t-l facility\tSyslog facility (default: LOCAL4)\n"
#endif #endif
"\t-n serverName\tService name\n" "\t-n serverName\tService name\n"
@ -348,7 +348,7 @@ int main( int argc, char **argv )
#if defined(HAVE_CHROOT) #if defined(HAVE_CHROOT)
char *sandbox = NULL; char *sandbox = NULL;
#endif #endif
#ifdef LOG_LOCAL4 #ifdef SLAP_DEFAULT_SYSLOG_USER
int syslogUser = SLAP_DEFAULT_SYSLOG_USER; int syslogUser = SLAP_DEFAULT_SYSLOG_USER;
#endif #endif
@ -675,6 +675,7 @@ unhandled_option:;
if ( version > 1 ) goto stop; if ( version > 1 ) goto stop;
} }
#if defined(LDAP_DEBUG) && defined(LDAP_SYSLOG)
{ {
char *logName; char *logName;
#ifdef HAVE_EBCDIC #ifdef HAVE_EBCDIC
@ -693,6 +694,7 @@ unhandled_option:;
free( logName ); free( logName );
#endif #endif
} }
#endif /* LDAP_DEBUG && LDAP_SYSLOG */
Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 ); Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );

View File

@ -47,13 +47,13 @@ static FILE *leakfile;
static LDIFFP dummy; static LDIFFP dummy;
#ifdef LDAP_SYSLOG #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
int start_syslog; int start_syslog;
static char **syslog_unknowns; static char **syslog_unknowns;
#ifdef LOG_LOCAL4 #ifdef LOG_LOCAL4
static int syslogUser = SLAP_DEFAULT_SYSLOG_USER; static int syslogUser = SLAP_DEFAULT_SYSLOG_USER;
#endif /* LOG_LOCAL4 */ #endif /* LOG_LOCAL4 */
#endif /* LDAP_SYSLOG */ #endif /* LDAP_DEBUG && LDAP_SYSLOG */
static void static void
usage( int tool, const char *progname ) usage( int tool, const char *progname )
@ -165,7 +165,7 @@ parse_slapopt( void )
} else if ( strncasecmp( optarg, "authzDN", len ) == 0 ) { } else if ( strncasecmp( optarg, "authzDN", len ) == 0 ) {
ber_str2bv( p, 0, 1, &authzDN ); ber_str2bv( p, 0, 1, &authzDN );
#ifdef LDAP_SYSLOG #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
} else if ( strncasecmp( optarg, "syslog", len ) == 0 ) { } else if ( strncasecmp( optarg, "syslog", len ) == 0 ) {
if ( parse_debug_level( p, &ldap_syslog, &syslog_unknowns ) ) { if ( parse_debug_level( p, &ldap_syslog, &syslog_unknowns ) ) {
return -1; return -1;
@ -185,7 +185,7 @@ parse_slapopt( void )
} }
start_syslog = 1; start_syslog = 1;
#endif /* LOG_LOCAL4 */ #endif /* LOG_LOCAL4 */
#endif /* LDAP_SYSLOG */ #endif /* LDAP_DEBUG && LDAP_SYSLOG */
} else { } else {
return -1; return -1;
@ -417,7 +417,7 @@ slap_tool_init(
} }
} }
#ifdef LDAP_SYSLOG #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
if ( start_syslog ) { if ( start_syslog ) {
char *logName; char *logName;
#ifdef HAVE_EBCDIC #ifdef HAVE_EBCDIC
@ -436,7 +436,7 @@ slap_tool_init(
free( logName ); free( logName );
#endif #endif
} }
#endif /* LDAP_SYSLOG */ #endif /* LDAP_DEBUG && LDAP_SYSLOG */
switch ( tool ) { switch ( tool ) {
case SLAPADD: case SLAPADD:
@ -523,7 +523,7 @@ slap_tool_init(
exit( EXIT_FAILURE ); exit( EXIT_FAILURE );
} }
#ifdef LDAP_SYSLOG #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG)
if ( syslog_unknowns ) { if ( syslog_unknowns ) {
rc = parse_debug_unknowns( syslog_unknowns, &ldap_syslog ); rc = parse_debug_unknowns( syslog_unknowns, &ldap_syslog );
ldap_charray_free( syslog_unknowns ); ldap_charray_free( syslog_unknowns );