From: Julio Sánchez Fernández Date: Sun, 30 May 1999 00:07:40 +0000 (+0000) Subject: Oops, fp_parse_line tokenizes in place, so we need to take a copy of X-Git-Tag: OPENLDAP_REL_ENG_2_BP~472 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ae481022f91b73caee0453daf5d58815b9c5c9b6;p=openldap Oops, fp_parse_line tokenizes in place, so we need to take a copy of input before letting fp_parse_line ruin it. --- diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 1e39a65e84..7243135fbd 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -40,7 +40,7 @@ int read_config( char *fname ) { FILE *fp; - char *line, *savefname; + char *line, *savefname, *saveline; int cargc, savelineno; char *cargv[MAXARGS]; int lineno, i; @@ -69,6 +69,9 @@ read_config( char *fname ) 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 ); } @@ -348,7 +351,7 @@ read_config( char *fname ) } 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 ); @@ -358,7 +361,7 @@ read_config( char *fname ) } 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, @@ -558,6 +561,7 @@ read_config( char *fname ) fname, lineno, cargv[0] ); } } + free( saveline ); } fclose( fp ); return( 0 );