[PATCH] fix return of resolve_ads if there is no answer

Michael Adam obnox at samba.org
Wed Jul 1 00:19:47 MDT 2015


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.

Michael
-------------- next part --------------
From 316fe7725f3ce95648470980899f91398d593405 Mon Sep 17 00:00:00 2001
From: Michael Adam <obnox at samba.org>
Date: Tue, 30 Jun 2015 16:51:43 +0200
Subject: [PATCH] s3:libsmb: fix resolve_ads return if there were no answers

Signed-off-by: Michael Adam <obnox at samba.org>
---
 source3/libsmb/namequery.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 5e48474..7eb5dff 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -2478,6 +2478,13 @@ static NTSTATUS resolve_ads(const char *name,
 		return status;
 	}
 
+	if (numdcs == 0) {
+		*return_iplist = NULL;
+		*return_count = 0;
+		talloc_destroy(ctx);
+		return NT_STATUS_OK;
+	}
+
 	for (i=0;i<numdcs;i++) {
 		if (!dcs[i].ss_s) {
 			numaddrs += 1;
-- 
2.4.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150701/cc69a6ae/attachment.pgp>


More information about the samba-technical mailing list