From f87e70a93028cb64ed4793cb1db6b978fa917697 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 27 Jun 2015 09:31:21 +0200 Subject: [PATCH] s3:libads: improve debug levels/messages in ads_find_dc() We should not flood the logs (and syslog) with fallback warnings. Signed-off-by: Stefan Metzmacher Reviewed-by: Michael Adam Autobuild-User(master): Michael Adam Autobuild-Date(master): Thu Jul 2 14:41:31 CEST 2015 on sn-devel-104 --- source3/libads/ldap.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c index 5c53c6326e0..87631641ff1 100644 --- a/source3/libads/ldap.c +++ b/source3/libads/ldap.c @@ -467,7 +467,7 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) } if (!*c_realm && !*c_domain) { - DEBUG(1, ("ads_find_dc: no realm or workgroup! Don't know " + DEBUG(0, ("ads_find_dc: no realm or workgroup! Don't know " "what to do\n")); return NT_STATUS_INVALID_PARAMETER; /* rather need MISSING_PARAMETER ... */ } @@ -515,10 +515,10 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) * - Guenther */ if (sitename) { - DEBUG(1, ("ads_find_dc: failed to find a valid DC on " - "our site (%s), " - "trying to find another DC\n", - sitename)); + DEBUG(3, ("ads_find_dc: failed to find a valid DC on " + "our site (%s), Trying to find another DC " + "for realm '%s' (domain '%s')\n", + sitename, c_realm, c_domain)); namecache_delete(c_realm, 0x1C); status = resolve_and_ping_dns(ads, NULL, c_realm); @@ -536,14 +536,20 @@ static NTSTATUS ads_find_dc(ADS_STRUCT *ads) or if configuration specifically requests it */ if (*c_domain) { if (*c_realm) { - DEBUG(1, ("ads_find_dc: falling back to netbios " - "name resolution for domain %s\n", - c_domain)); + DEBUG(3, ("ads_find_dc: falling back to netbios " + "name resolution for domain '%s' (realm '%s')\n", + c_domain, c_realm)); } status = resolve_and_ping_netbios(ads, c_domain, c_realm); + if (NT_STATUS_IS_OK(status)) { + return status; + } } + DEBUG(1, ("ads_find_dc: " + "name resolution for realm '%s' (domain '%s') failed: %s\n", + c_realm, c_domain, nt_errstr(status))); return status; } -- 2.34.1