more robust ldap.rb