X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslurpd%2Fconfig.c;h=71934ce59efc95a1555eb6720e3063d7254a51c9;hb=4abbf9c610d4fbaeee0dbdceaad1e0f94ed8e8fe;hp=ba0403ec5b66fb8faeb86314ab9b093ad584dbdf;hpb=3c598e89fb34a892d369a138daa8c3314294493c;p=openldap diff --git a/servers/slurpd/config.c b/servers/slurpd/config.c index ba0403ec5b..71934ce59e 100644 --- a/servers/slurpd/config.c +++ b/servers/slurpd/config.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2004 The OpenLDAP Foundation. + * Copyright 1998-2005 The OpenLDAP Foundation. * Portions Copyright 2003 Mark Benson. * Portions Copyright 2002 John Morrissey. * All rights reserved. @@ -47,6 +47,7 @@ #include #include +#include #include "slurp.h" #include "globals.h" @@ -86,14 +87,8 @@ slurpd_read_config( cargv_size = ARGS_STEP + 1; } -#ifdef NEW_LOGGING - LDAP_LOG ( CONFIG, ARGS, - "slurpd_read_config: Config: opening config file \"%s\"\n", - fname, 0, 0 ); -#else Debug( LDAP_DEBUG_CONFIG, "Config: opening config file \"%s\"\n", fname, 0, 0 ); -#endif if ( (fp = fopen( fname, "r" )) == NULL ) { perror( fname ); @@ -107,12 +102,7 @@ slurpd_read_config( continue; } -#ifdef NEW_LOGGING - LDAP_LOG ( CONFIG, DETAIL1, - "slurpd_read_config: Config: (%s)\n", line, 0, 0 ); -#else Debug( LDAP_DEBUG_CONFIG, "Config: (%s)\n", line, 0, 0 ); -#endif parse_line( line ); @@ -141,6 +131,7 @@ slurpd_read_config( lineno, cargv[1] ); fprintf( stderr, "line (ignored)\n" ); } + LUTIL_SLASHPATH( cargv[1] ); strcpy( sglob->slapd_replogfile, cargv[1] ); } } else if ( strcasecmp( cargv[0], "replica" ) == 0 ) { @@ -152,18 +143,13 @@ slurpd_read_config( int savelineno; if ( cargc < 2 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d: missing filename in \"include " - "\" line.\n", fname, lineno , 0 ); -#else Debug( LDAP_DEBUG_ANY, "%s: line %d: missing filename in \"include \" line\n", fname, lineno, 0 ); -#endif return( 1 ); } + LUTIL_SLASHPATH( cargv[1] ); savefname = strdup( cargv[1] ); savelineno = lineno; @@ -176,50 +162,53 @@ slurpd_read_config( } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) { if ( cargc < 2 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: line %d missing file name in \"replica-pidfile \" " - "line.\n", fname, lineno, 0 ); -#else Debug( LDAP_DEBUG_ANY, "%s: line %d: missing file name in \"replica-pidfile \" line\n", fname, lineno, 0 ); -#endif return( 1 ); } + LUTIL_SLASHPATH( cargv[1] ); slurpd_pid_file = ch_strdup( cargv[1] ); } else if ( strcasecmp( cargv[0], "replica-argsfile" ) == 0 ) { if ( cargc < 2 ) { -#ifdef NEW_LOGGING - LDAP_LOG( CONFIG, CRIT, - "%s: %d: missing file name in " - "\"argsfile \" line.\n", - fname, lineno, 0 ); -#else Debug( LDAP_DEBUG_ANY, "%s: line %d: missing file name in \"argsfile \" line\n", fname, lineno, 0 ); -#endif return( 1 ); } + LUTIL_SLASHPATH( cargv[1] ); slurpd_args_file = ch_strdup( cargv[1] ); - } + + } else if ( strcasecmp( cargv[0], "replicationinterval" ) == 0 ) { + int c; + if ( cargc < 2 ) { + Debug( LDAP_DEBUG_ANY, "%s: line %d: missing interval in " + "\"replicationinterval \" line\n", + fname, lineno, 0 ); + return( 1 ); + } + + c = atoi( cargv[1] ); + if( c < 1 ) { + Debug( LDAP_DEBUG_ANY, "%s: line %d: invalid interval " + "(%d) in \"replicationinterval \" line\n", + fname, lineno, c ); + + return( 1 ); + } + + sglob->no_work_interval = c; + } } fclose( fp ); -#ifdef NEW_LOGGING - LDAP_LOG ( CONFIG, RESULTS, - "slurpd_read_config: Config: " - "** configuration file successfully read and parsed\n", 0, 0, 0 ); -#else Debug( LDAP_DEBUG_CONFIG, "Config: ** configuration file successfully read and parsed\n", 0, 0, 0 ); -#endif return 0; } @@ -399,19 +388,11 @@ add_replica( sglob->replicas[ nr - 1] = NULL; sglob->num_replicas--; } else { -#ifdef NEW_LOGGING - LDAP_LOG ( CONFIG, RESULTS, - "add_replica: Config: ** successfully added replica \"%s%d\"\n", - sglob->replicas[ nr - 1 ]->ri_hostname == NULL ? - "(null)" : sglob->replicas[ nr - 1 ]->ri_hostname, - sglob->replicas[ nr - 1 ]->ri_port, 0 ); -#else Debug( LDAP_DEBUG_CONFIG, "Config: ** successfully added replica \"%s:%d\"\n", sglob->replicas[ nr - 1 ]->ri_hostname == NULL ? "(null)" : sglob->replicas[ nr - 1 ]->ri_hostname, sglob->replicas[ nr - 1 ]->ri_port, 0 ); -#endif sglob->replicas[ nr - 1]->ri_stel = sglob->st->st_add( sglob->st, sglob->replicas[ nr - 1 ] );