Skip to content

Commit 595b6f5

Browse files
jakesmithghalliday
authored andcommitted
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 <[email protected]>
1 parent 0c599f7 commit 595b6f5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

system/jlib/jsocket.cpp

+7-3
Original file line numberDiff line numberDiff line change
@@ -6449,15 +6449,19 @@ StringBuffer &SocketEndpointArray::getText(StringBuffer &text) const
64496449
return item(0).getEndpointHostText(text);
64506450
byte lastip[4];
64516451
const SocketEndpoint &first = item(0);
6452-
bool lastis4 = first.getNetAddress(sizeof(lastip),&lastip)==sizeof(lastip);
6453-
unsigned short lastport = first.port;
64546452
first.getHostText(text);
6453+
bool lastis4 = false;
6454+
if (!first.queryHostname())
6455+
lastis4 = first.getNetAddress(sizeof(lastip),&lastip)==sizeof(lastip);
6456+
unsigned short lastport = first.port;
64556457
unsigned rep=0;
64566458
unsigned range=0;
64576459
for (unsigned i=1;i<count;i++) {
64586460
byte ip[4];
64596461
const SocketEndpoint &ep = item(i);
6460-
bool is4 = ep.getNetAddress(sizeof(ip),&ip)==sizeof(ip);
6462+
bool is4 = false;
6463+
if (!ep.queryHostname())
6464+
is4 = ep.getNetAddress(sizeof(ip),&ip)==sizeof(ip);
64616465
if (!lastis4||!is4) {
64626466
flushText(text,lastport,rep,range);
64636467
text.append(',');

0 commit comments

Comments
 (0)