As it hangs in endpwent I do not recognize this as sendmail fault. The problem is that while closing the ldap connection in endpwent it calls the ldap_result with NULL handle and this call causes the hang. Commenting the endpwent call in sendmail doesn't solve the matter of this problem. I think that it should be fixed in nss_ldap, because it is known problem and there also exists upstream bugzilla for it:
Created attachment 430663 [details]
Slightly modified patch from upstream bugzilla. This patch resolves the problem for me. Same patch is used in all later versions of nss_ldap.
I propose reassigning this to nss_ldap and using patch from comment 8.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
The "endpwent" function called ldap query with the NULL handle and the parent process crashed. With this update, the handle is used only if it is valid.
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.