https://bugs.openldap.org/show_bug.cgi?id=9920
--- Comment #4 from Howard Chu hyc@openldap.org --- For the first part, I've created a different patch from yours
https://git.openldap.org/openldap/openldap/-/merge_requests/567
Will try to duplicate your results later.