mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-27 17:19:19 -05:00
Ignore comments surrounded by empty lines in ldif_read_record().
Slapadd treated these as separate, incorrect, entries.
This commit is contained in:
parent
f5a79a34cc
commit
e0999334d2
1 changed files with 14 additions and 7 deletions
|
|
@ -571,7 +571,7 @@ ldif_read_record(
|
|||
{
|
||||
char linebuf[BUFSIZ], *line, *nbufp;
|
||||
ber_len_t lcur = 0, len, linesize;
|
||||
int last_ch = '\n', found_entry = 0, stop;
|
||||
int last_ch = '\n', found_entry = 0, stop, top_comment = 0;
|
||||
|
||||
line = linebuf;
|
||||
linesize = sizeof( linebuf );
|
||||
|
|
@ -588,18 +588,25 @@ ldif_read_record(
|
|||
(*lno)++;
|
||||
|
||||
if ( line[0] == '\n' ) {
|
||||
if ( !found_entry )
|
||||
if ( !found_entry ) {
|
||||
lcur = 0;
|
||||
top_comment = 0;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ( !found_entry ) {
|
||||
/* Found a new entry */
|
||||
found_entry = 1;
|
||||
if ( line[0] == '#' ) {
|
||||
top_comment = 1;
|
||||
} else if ( ! ( top_comment && line[0] == ' ' ) ) {
|
||||
/* Found a new entry */
|
||||
found_entry = 1;
|
||||
|
||||
if ( isdigit( (unsigned char) line[0] ) ) {
|
||||
/* skip index */
|
||||
continue;
|
||||
if ( isdigit( (unsigned char) line[0] ) ) {
|
||||
/* skip index */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue