read_config( char *fname )
{
FILE *fp;
- char *line, *savefname;
+ char *line, *savefname, *saveline;
int cargc, savelineno;
char *cargv[MAXARGS];
int lineno, i;
Debug( LDAP_DEBUG_CONFIG, "line %d (%s)\n", lineno, line, 0 );
+ /* fp_parse_line is destructive, we save a copy */
+ saveline = ch_strdup( line );
+
if ( fp_parse_line( line, &cargc, cargv ) != 0 ) {
return( 1 );
}
} else if ( strcasecmp( cargv[0], "objectclass" ) == 0 ) {
if ( *cargv[1] == '(' ) {
char * p;
- p = strchr(line,'(');
+ p = strchr(saveline,'(');
parse_oc( fname, lineno, p );
} else {
parse_oc_old( be, fname, lineno, cargc, cargv );
} else if ( strcasecmp( cargv[0], "attribute" ) == 0 ) {
if ( *cargv[1] == '(' ) {
char * p;
- p = strchr(line,'(');
+ p = strchr(saveline,'(');
parse_at( fname, lineno, p );
} else {
attr_syntax_config( fname, lineno, cargc - 1,
fname, lineno, cargv[0] );
}
}
+ free( saveline );
}
fclose( fp );
return( 0 );