From 0dae0704c01adb8b336d35647e75b45c0c21cc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Fri, 18 Mar 2022 14:51:45 +0000 Subject: [PATCH] ITS#9811 Allow newlines at end of included file --- libraries/libldap/ldif.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/libldap/ldif.c b/libraries/libldap/ldif.c index 7ca5e32cf..900a97960 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 { -- 2.33.0