From: Ondřej Kuzník Date: Fri, 18 Mar 2022 14:51:45 +0000 (+0000) Subject: ITS#9811 Allow newlines at end of included file X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dae0704c01adb8b336d35647e75b45c0c21cc10;p=thirdparty%2Fopenldap.git ITS#9811 Allow newlines at end of included file --- diff --git a/libraries/libldap/ldif.c b/libraries/libldap/ldif.c index 7ca5e32cf9..900a979607 100644 --- a/libraries/libldap/ldif.c +++ b/libraries/libldap/ldif.c @@ -796,6 +796,7 @@ ldif_read_record( * back to a previous file. (return from an include) */ while ( feof( lfp->fp )) { +pop: if ( lfp->prev ) { LDIFFP *tmp = lfp->prev; fclose( lfp->fp ); @@ -808,6 +809,10 @@ ldif_read_record( } if ( !stop ) { if ( fgets( line, sizeof( line ), lfp->fp ) == NULL ) { + if ( !found_entry && !ferror( lfp->fp ) ) { + /* ITS#9811 Reached the end looking for an entry, try again */ + goto pop; + } stop = 1; len = 0; } else {