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-30455 Fix a bug when trying to validate empty host #17912

Merged
Merged
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
7 changes: 4 additions & 3 deletions esp/smc/SMCLib/TpCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ extern TPWRAPPER_API IPropertyTree* getDropZoneAndValidateHostAndPath(const char
dropZone.setown(getDropZonePlane(dropZoneName));
if (!dropZone)
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "DropZone '%s' not found.", dropZoneName);
if (!validateDropZone(dropZone, pathToCheck, hostToCheck, isIPAddress(hostToCheck)))
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "The host '%s' or path '%s' is not valid for dropzone %s.",
isEmptyString(host) ? "unspecified" : host, isEmptyString(path) ? "unspecified" : path, dropZoneName);
if (!isEmptyString(hostToCheck) && !isHostInPlane(dropZone, hostToCheck, isIPAddress(hostToCheck)))
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "The host '%s' is not valid for dropzone %s.", host, dropZoneName);
if (!isEmptyString(pathToCheck) && !isPathInPlane(dropZone, pathToCheck))
throw makeStringExceptionV(ECLWATCH_INVALID_INPUT, "The path '%s' is not valid for dropzone %s.", path, dropZoneName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks ok, and improves the error reporting,

but using validateDropZone was problematic because hostToCheck was not null, but was empty?
If so, validateDropZone should probably be changed too, changing if (host) to if (!isEmptyString(host))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but using validateDropZone was problematic because hostToCheck was not null, but was empty?

Yes.

If so, validateDropZone should probably be changed too, changing if (host) to if (!isEmptyString(host))

I was wondering why the validateDropZone() uses 'if (host)' not 'if (!isEmptyString(host))'. I will create another JIRA to change it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
return dropZone.getClear();
}
Expand Down
Loading