summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2011-01-06 16:23:54 +0100
committerGünther Deschner <gd@samba.org>2011-01-06 17:29:11 +0100
commitfa1fd85eea549d2944974ddbc67e21ef9231c49b (patch)
treefa2748b8beabd275365d888f2b66a84fa54184d8 /source3
parent7ee75c95481f0d13598577361d18e96cb8394b9c (diff)
downloadsamba-fa1fd85eea549d2944974ddbc67e21ef9231c49b.tar.gz
samba-fa1fd85eea549d2944974ddbc67e21ef9231c49b.tar.bz2
samba-fa1fd85eea549d2944974ddbc67e21ef9231c49b.zip
s3-net: Fix bug #7690: retry DNS updates when connection to one nameserver has failed.
Initial patch from Patrik Martinsson <patrik.martinsson@smhi.se>. Guenther Autobuild-User: Günther Deschner <gd@samba.org> Autobuild-Date: Thu Jan 6 17:29:11 CET 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/net_ads.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index 48df564792..ac14184aa8 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1132,7 +1132,7 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
int num_addrs)
{
struct dns_rr_ns *nameservers = NULL;
- int ns_count = 0;
+ int ns_count = 0, i;
NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
DNS_ERROR dns_err;
fstring dns_server;
@@ -1197,16 +1197,31 @@ static NTSTATUS net_update_dns_internal(TALLOC_CTX *ctx, ADS_STRUCT *ads,
}
- /* Now perform the dns update - we'll try non-secure and if we fail,
- we'll follow it up with a secure update */
+ for (i=0; i < ns_count; i++) {
- fstrcpy( dns_server, nameservers[0].hostname );
+ /* Now perform the dns update - we'll try non-secure and if we fail,
+ we'll follow it up with a secure update */
+
+ fstrcpy( dns_server, nameservers[i].hostname );
+
+ dns_err = DoDNSUpdate(dns_server, dnsdomain, machine_name, addrs, num_addrs);
+ if (ERR_DNS_IS_OK(dns_err)) {
+ status = NT_STATUS_OK;
+ goto done;
+ }
+
+ if (ERR_DNS_EQUAL(dns_err, ERROR_DNS_INVALID_NAME_SERVER) ||
+ ERR_DNS_EQUAL(dns_err, ERROR_DNS_CONNECTION_FAILED) ||
+ ERR_DNS_EQUAL(dns_err, ERROR_DNS_SOCKET_ERROR)) {
+ DEBUG(1,("retrying DNS update with next nameserver after receiving %s\n",
+ dns_errstr(dns_err)));
+ continue;
+ }
- dns_err = DoDNSUpdate(dns_server, dnsdomain, machine_name, addrs, num_addrs);
- if (!ERR_DNS_IS_OK(dns_err)) {
d_printf(_("DNS Update for %s failed: %s\n"),
machine_name, dns_errstr(dns_err));
status = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
done: