+ if ( cargc < 1 ) {
+ fprintf( stderr, "line %d: bad config line (ignored)\n", lineno );
+ continue;
+ }
+
+ /* replication log file to which changes are appended */
+ if ( strcasecmp( cargv[0], "replogfile" ) == 0 ) {
+ /*
+ * if slapd_replogfile has a value, the -r option was given,
+ * so use that value. If slapd_replogfile has length == 0,
+ * then we should use the value in the config file we're reading.
+ */
+ if ( cargc < 2 ) {
+ fprintf( stderr,
+ "line %d: missing filename in \"replogfile ",
+ lineno );
+ fprintf( stderr, "<filename>\" line\n" );
+ exit( EXIT_FAILURE );
+
+ } else if ( cargc > 2 && *cargv[2] != '#' ) {
+ fprintf( stderr,
+ "line %d: extra cruft at the end of \"replogfile %s\"",
+ lineno, cargv[1] );
+ fprintf( stderr, "line (ignored)\n" );
+ }
+
+ LUTIL_SLASHPATH( cargv[1] );
+ if ( sglob->slapd_replogfile[0] == '\0' ) {
+ strcpy( sglob->slapd_replogfile, cargv[1] );
+ GOT_REPLOG_SET(got_replog, GOT_REPLOG_YES);
+
+ } else {
+ if ( strcmp( sglob->slapd_replogfile, cargv[1] ) == 0 ) {
+ GOT_REPLOG_SET(got_replog, GOT_REPLOG_YES);
+
+ } else if ( GOT_REPLOG(got_replog) == GOT_REPLOG_YES ) {
+ GOT_REPLOG_SET(got_replog, GOT_REPLOG_DONE);
+
+ } else {
+ GOT_REPLOG_SET(got_replog, GOT_REPLOG_ONE);
+ }
+ }
+
+ } else if ( strcasecmp( cargv[0], "replica" ) == 0 ) {
+ add_replica( cargv, cargc );
+
+ /* include another config file */
+ } else if ( strcasecmp( cargv[0], "include" ) == 0 ) {
+ char *savefname;
+ int savelineno;
+
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing filename in \"include <filename>\" line\n",
+ fname, lineno, 0 );
+
+ return( 1 );
+ }
+ LUTIL_SLASHPATH( cargv[1] );
+ savefname = strdup( cargv[1] );
+ savelineno = lineno;
+
+ if ( slurpd_read_config( savefname ) != 0 ) {
+ return( 1 );
+ }
+
+ free( savefname );
+ lineno = savelineno - 1;
+
+ } else if ( strcasecmp( cargv[0], "replica-pidfile" ) == 0 ) {
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing file name in \"replica-pidfile <file>\" line\n",
+ fname, lineno, 0 );
+
+ return( 1 );
+ }
+
+ switch ( GOT_REPLOG(got_replog) ) {
+ case GOT_REPLOG_YES:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "got replog specific replica-pidfile \"%s\".\n",
+ fname, lineno, cargv[1] );
+ case GOT_REPLOG_NO:
+ LUTIL_SLASHPATH( cargv[1] );
+ if ( slurpd_pid_file != NULL ) {
+ ch_free( slurpd_pid_file );
+ }
+ slurpd_pid_file = ch_strdup( cargv[1] );
+ got_replog |= GOT_REPLOG_PID;
+ break;
+
+ default:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "replica-pidfile \"%s\" not mine.\n",
+ fname, lineno, cargv[1] );
+ break;
+ }
+
+ } else if ( strcasecmp( cargv[0], "replica-argsfile" ) == 0 ) {
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "%s: line %d: missing file name in \"argsfile <file>\" line\n",
+ fname, lineno, 0 );
+
+ return( 1 );
+ }
+
+ switch ( GOT_REPLOG(got_replog) ) {
+ case GOT_REPLOG_YES:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "got replog specific replica-argsfile \"%s\".\n",
+ fname, lineno, cargv[1] );
+ case GOT_REPLOG_NO:
+ LUTIL_SLASHPATH( cargv[1] );
+ if ( slurpd_args_file != NULL ) {
+ ch_free( slurpd_args_file );
+ }
+ slurpd_args_file = ch_strdup( cargv[1] );
+ got_replog |= GOT_REPLOG_ARGS;
+ break;
+
+ default:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "replica-argsfile \"%s\" not mine.\n",
+ fname, lineno, cargv[1] );
+ break;
+ }
+
+ } else if ( strcasecmp( cargv[0], "replicationinterval" ) == 0 ) {
+ int c;
+
+ if ( cargc < 2 ) {
+ Debug( LDAP_DEBUG_ANY, "%s: line %d: missing interval in "
+ "\"replicationinterval <seconds>\" line\n",
+ fname, lineno, 0 );
+ return( 1 );
+ }
+
+ if ( lutil_atoi( &c, cargv[1] ) != 0 || c < 1 ) {
+ Debug( LDAP_DEBUG_ANY, "%s: line %d: invalid interval "
+ "(%d) in \"replicationinterval <seconds>\" line\n",
+ fname, lineno, c );
+
+ return( 1 );
+ }
+
+ switch ( GOT_REPLOG(got_replog) ) {
+ case GOT_REPLOG_YES:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "got replog specific replicationinterval \"%s\".\n",
+ fname, lineno, cargv[1] );
+ case GOT_REPLOG_NO:
+ sglob->no_work_interval = c;
+ got_replog |= GOT_REPLOG_INTERVAL;
+ break;
+
+ default:
+ Debug( LDAP_DEBUG_CONFIG, "%s: line %d: "
+ "replicationinterval \"%s\" not mine.\n",
+ fname, lineno, cargv[1] );
+ break;
+ }