From 595b6f53895e9084f80aa065c081a343f6d34270 Mon Sep 17 00:00:00 2001 From: Jake Smith Date: Tue, 5 Nov 2024 09:33:36 +0000 Subject: [PATCH] HPCC-32664 Fix bug creating DFS Group text causing DNS failures The changes introduced in HPCC-18382 (which preserved hostnames), caused group text (via SocketEndpointArray::getText) to be corrupted under certain circumstances. If the resolved IP of the hostnames in array were sequences, the function encoded it as such, then corrupt the hostnames when deserialized (fromText) was used. Signed-off-by: Jake Smith --- system/jlib/jsocket.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/system/jlib/jsocket.cpp b/system/jlib/jsocket.cpp index 69541207b67..2f99fa77e84 100644 --- a/system/jlib/jsocket.cpp +++ b/system/jlib/jsocket.cpp @@ -6449,15 +6449,19 @@ StringBuffer &SocketEndpointArray::getText(StringBuffer &text) const return item(0).getEndpointHostText(text); byte lastip[4]; const SocketEndpoint &first = item(0); - bool lastis4 = first.getNetAddress(sizeof(lastip),&lastip)==sizeof(lastip); - unsigned short lastport = first.port; first.getHostText(text); + bool lastis4 = false; + if (!first.queryHostname()) + lastis4 = first.getNetAddress(sizeof(lastip),&lastip)==sizeof(lastip); + unsigned short lastport = first.port; unsigned rep=0; unsigned range=0; for (unsigned i=1;i