Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HPCC-31182 Fix ResolveHostName to return the resolved ip, not the hostname #18258

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion plugins/fileservices/fileservices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2720,7 +2720,8 @@ FILESERVICES_API char * FILESERVICES_CALL fsfResolveHostName(const char *hostna
{
StringBuffer ret;
SocketEndpoint ep(hostname);
ep.getHostText(ret);
//NB: Get a string for the resolved IP, not the hostname
ep.getIpText(ret);
return ret.detach();
}

Expand Down
2 changes: 2 additions & 0 deletions testing/regress/ecl/fileservice.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import Std.File;
import Std.Str;
import Std.System;
import $.setup;
prefix := setup.Files(false, false).QueryFilePrefix;

Expand Down Expand Up @@ -57,4 +58,5 @@ SEQUENTIAL(
RemovePrefix(File.ForeignLogicalFileName('somescope::somefilename', '192.168.168.168', false), 3);
RemovePrefix(File.ForeignLogicalFileName('somescope::somefilename', '192.168.168.168', true, true), 2);
RemovePrefix(File.ForeignLogicalFileName('somescope::somefilename', '192.168.168.168', false, true), 2);
OUTPUT((INTEGER)System.Util.ResolveHostName('localhost') != 0); // Check that host names are resolved to actual IP addresses
);
3 changes: 3 additions & 0 deletions testing/regress/ecl/key/fileservice.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@
<Dataset name='Result 9'>
<Row><Result_9>somescope::somefilename</Result_9></Row>
</Dataset>
<Dataset name='Result 10'>
<Row><Result_10>true</Result_10></Row>
</Dataset>
Loading