Skip to content

Commit

Permalink
HPCC-32664 Fix bug creating DFS Group text causing DNS failures
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
jakesmith authored and ghalliday committed Nov 5, 2024
1 parent f0a1e8f commit 983ab4f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<count;i++) {
byte ip[4];
const SocketEndpoint &ep = item(i);
bool is4 = ep.getNetAddress(sizeof(ip),&ip)==sizeof(ip);
bool is4 = false;
if (!ep.queryHostname())
is4 = ep.getNetAddress(sizeof(ip),&ip)==sizeof(ip);
if (!lastis4||!is4) {
flushText(text,lastport,rep,range);
text.append(',');
Expand Down

0 comments on commit 983ab4f

Please sign in to comment.