From 213116ea8a16a10f4def750d92095c250b51def7 Mon Sep 17 00:00:00 2001
From: Sumit Bose <sbose@redhat.com>
Date: Fri, 7 Oct 2016 13:57:44 +0200
Subject: [PATCH 01/30] Handle empty string in client site name

parse_disco_string() returns an empty string if there is no client site
name in the NetLogon reply. Later in the code only a NULL check is used
to check for a missing client site name. To make sure the empty string
is not used as client site name it should be replaced with NULL.

https://bugs.freedesktop.org/show_bug.cgi?id=98143
---
 library/addisco.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/library/addisco.c b/library/addisco.c
index bf38e71..08d2c8e 100644
--- a/library/addisco.c
+++ b/library/addisco.c
@@ -378,6 +378,14 @@ parse_disco_data (struct berval *bv)
 		_adcli_info ("Received NetLogon info from: %s", disco->host_name);
 	}
 
+	/* If the DC cannot determine the client site it will return an empty
+         * string. Make sure this is handled the same way as a missing client
+         * site. */
+	if (disco->client_site[0] == '\0') {
+		free (disco->client_site);
+		disco->client_site = NULL;
+	}
+
 	/* We don't care about these */
 	free (user);
 	return disco;
-- 
2.11.0