TLS not working with latest openldap - Review and address latest Coverity issues
Ticket #281 - TLS not working with latest openldap
Ticket #161 - Review and address latest Coverity issues
(cherry picked from commit 28a0c1c5a7d00690e744f1a682a6792f2bab76bd)
(cherry picked from commit cedd5bf3d6f2058af6550e70cae1594bc17555a2)