Ldap fix tls detection

Fixes https://github.com/owncloud/core/issues/6369 https://github.com/owncloud/core/issues/6359

@stevenmcastano @typomedia if possible, could you please test?

Looking for reviewers, @karlitschek @PVince81 @ringmaster or others as well, thx