From 983ab4f217ee8ef6aebbc51f7780942f31d0bedb 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 9f4bb2d6b72..e5ce4770c47 100644 --- a/system/jlib/jsocket.cpp +++ b/system/jlib/jsocket.cpp @@ -6380,15 +6380,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