[PATCH] fix return of resolve_ads if there is no answer
Stefan (metze) Metzmacher
metze at samba.org
Wed Jul 1 09:54:17 MDT 2015
Am 01.07.2015 um 08:19 schrieb Michael Adam:
> Hi,
>
> Looking at autobuild-logs, I observed a ton of messages like
>
> [...]/b5997/samba/bin/winbindd: resolve_ads: malloc failed for 0 entries
>
> This uncovered that resolve_ads does not treat the
> case with 0 answers correctly. Attached is a patch
> to fix resolve_ads.
>
> Review/Push appreciated.
Reviewed-by: me
Something related attached...
metze
-------------- next part --------------
From 74ad47621dea55314f5bd93085db17f819a29869 Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
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 <metze at samba.org>
---
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 5c53c63..8763164 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;
}
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150701/cadd05e1/attachment.pgp>
More information about the samba-technical
mailing list