Dave Horsfall writes:
RFC 2489 (LDAP Data Interchange Format) says: "An LDIF file consists of a series of records separated by line separators."
This implies that there should not be a blank line at the end of an LDIF file (separator vs. terminator). Believe it or not, this caused a rather heated discussion...
RFC 2849. And the RFC's grammar agrees.
LDAPSEARCH will always include a trailing newline if there is data; is this technically correct behaviour?
No. Nor would a pedantic LDIF parser accept it. I wouldn't suggest changing it at this time though, the behavior is so well established. Maybe in OpenLDAP 2.5, or maybe it's time to revise the LDIF RFC if others are doing the same thing as OpenLDAP. (One advantage of the extra LF at the end is that you can concatenate the output from two ldapsearch -LLL commands.)