Another question:
How should backends handle the return value from, and rs->sr_err to/from, send_search_entry() and send_search_reference()? The back-ldif handling differs from back-bdb/search.c.
At one point ldapsearch got insufficientAccessRights when an entry _below_ baseDN in the search scope was ACL-protected. But I can't reproduce it, and don't know if the error was mine or back-ldif's.
Other details:
ldif_back_search() modified op->ors_scope. That looked improper, I removed it.
The ENOENT special case for rename() in spew_entry() made little sense, since it was just moving the file it just created, and to the same directory. I deleted it, but I wonder why it was there.
I wrote:
+ Sorting (in ldif_r_enum_tree()): Should "a={1}x" sort before or after "a=x"? Currently it sorts like "a={". "a=" (normally before) or "a=<CHAR_MAX>" (normally after) would be better.
No, UCHAR_MAX. strcmp compares the strings as unsigned char*.