]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9811 Allow newlines at end of included file
authorOndřej Kuzník <ondra@mistotebe.net>
Fri, 18 Mar 2022 14:51:45 +0000 (14:51 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 21 Mar 2022 21:56:53 +0000 (21:56 +0000)
libraries/libldap/ldif.c

index 7ca5e32cf942ff9507046d1020a1835cd362abd5..900a979607bf0db9f19773117f9eb22a4e7bd0d1 100644 (file)
@@ -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 {