From 8821f2149c6e095d08ec0cc525d2eb5f0228d737 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Thu, 30 Mar 2017 12:50:33 +0200 Subject: [PATCH] Move the empty client site check Currently this check will SEGV(NULL ptr access) if the parsing of Netlogon discovery data fails. Move the empty check to where the disco ptr is always valid. Add a log msg too. Signed-off-by: Joakim Tjernlund --- library/addisco.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/library/addisco.c b/library/addisco.c index 08d2c8e..8cc5bf0 100644 --- a/library/addisco.c +++ b/library/addisco.c @@ -376,14 +376,14 @@ parse_disco_data (struct berval *bv) disco = NULL; } else { _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; + /* 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; + _adcli_info ("Empty client site, skipping"); + } } /* We don't care about these */ -- 2.10.2