/* Returns ok only if it matches the correct server type */
ok = ads_try_connect(ads, false, &sa_list[i].u.ss);
- if (ok) {
+ if (ok && ads->config.ldap_server_name) {
NTSTATUS status;
status = check_negative_conn_cache(domain,
ads->config.ldap_server_name);
- if (NT_STATUS_IS_OK(status)) {
+ if (!NT_STATUS_IS_OK(status)) {
/*
- * only use the server if it's not black listed
- * by name
+ * if the the server is black listed
+ * by name, we avoid using it.
*/
- return NT_STATUS_OK;
+ ok = false;
}
}
+ if (ok) {
+ return NT_STATUS_OK;
+ }
+
/* keep track of failures */
add_failed_connection_entry(domain, server,
NT_STATUS_UNSUCCESSFUL);