char addr[INET6_ADDRSTRLEN];
print_sockaddr(addr, sizeof(addr), &sa->u.ss);
+ D_DEBUG("Trying to figure out the DC name for domain '%s' at IP '%s'.\n",
+ domain->name,
+ addr);
ads = ads_init(tmp_ctx,
domain->alt_name,
saf_store(domain->alt_name, name);
}
+ D_DEBUG("DC name for domain '%s' at IP '%s' is '%s'\n",
+ domain->name,
+ addr,
+ name);
*namep = talloc_move(mem_ctx, &name);
out:
*fd = -1;
+ D_NOTICE("First try to connect to the closest DC (using server "
+ "affinity cache). If this fails, try to lookup the DC using "
+ "DNS afterwards.\n");
ok = connect_preferred_dc(mem_ctx, domain, request_flags, fd);
if (ok) {
return true;
}
again:
+ D_DEBUG("Retrieving a list of IP addresses for DCs.\n");
if (!get_dcs(mem_ctx, domain, &dcs, &num_dcs, request_flags) || (num_dcs == 0))
return False;
+ D_DEBUG("Retrieved IP addresses for %d DCs.\n", num_dcs);
for (i=0; i<num_dcs; i++) {
if (!add_string_to_array(mem_ctx, dcs[i].name,
if ((addrs == NULL) || (dcnames == NULL))
return False;
+ D_DEBUG("Trying to establish a connection to one of the %d DCs "
+ "(timeout of 10 sec for each DC).\n",
+ num_dcs);
status = smbsock_any_connect(addrs, dcnames, NULL, NULL, NULL,
num_addrs, 0, 10, fd, &fd_index, NULL);
if (!NT_STATUS_IS_OK(status)) {
}
return False;
}
+ D_NOTICE("Successfully connected to DC '%s'.\n", dcs[fd_index].name);
domain->dcaddr = addrs[fd_index];
*fd = -1;
}
+ /*
+ * This should not be an infinite loop, since get_dcs() will not return
+ * the DC added to the negative connection cache in the above
+ * winbind_add_failed_connection_entry() call.
+ */
goto again;
}
return NT_STATUS_NO_MEMORY;
}
+ D_NOTICE("Creating connection to domain controller. This is a start of "
+ "a new connection or a DC failover. The failover only happens "
+ "if the domain has more than one DC. We will try to connect 3 "
+ "times at most.\n");
for (retries = 0; retries < 3; retries++) {
bool found_dc;
- DEBUG(10, ("cm_open_connection: dcname is '%s' for domain %s\n",
- domain->dcname ? domain->dcname : "", domain->name));
+ D_DEBUG("Attempt %d/3: DC '%s' of domain '%s'.\n",
+ retries,
+ domain->dcname ? domain->dcname : "",
+ domain->name);
found_dc = find_dc(mem_ctx, domain, request_flags, &fd);
if (!found_dc) {