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

XML-quote error messages sent through XrdHttp #1490

Merged
merged 1 commit into from
Aug 6, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/XrdHttp/XrdHttpReq.cc
Expand Up @@ -639,8 +639,12 @@ bool XrdHttpReq::Error(XrdXrootd::Bridge::Context &info, //!< the result context

xrdresp = kXR_error;
xrderrcode = (XErrorCode) ecode;
obfuscatepath(this->etext, etext_);

if (etext_) {
char *s = escapeXML(etext_);
this->etext = s;
free(s);
}

if (PostProcessHTTPReq()) reset();

Expand Down
29 changes: 0 additions & 29 deletions src/XrdHttp/XrdHttpUtils.cc
Expand Up @@ -439,32 +439,3 @@ char *escapeXML(const char *str) {



// If the text contains a path then it will not be seen as such by wannabe security tests
// Returns the number of chars that have been substituted
int obfuscatepath(std::string &strout, const char *strin) {
int l = strlen(strin);
strout.clear();
int i, j = 0;

for (i = 0; i < l; i++) {
const char c = strin[i];

switch (c) {
case '/':
strout.append(" / ");
j++;
break;
case '\\':
strout.append(" \\ ");
j++;
break;
default:
strout.push_back(c);
}
}


return j;
}


3 changes: 0 additions & 3 deletions src/XrdHttp/XrdHttpUtils.hh
Expand Up @@ -90,9 +90,6 @@ char *unquote(char *str);
char *escapeXML(const char *str);


// If the text contains a path then it will not be seen as such by wannabe security tests
// // Returns the number of chars that have been substituted
int obfuscatepath(std::string &, const char *);

#endif /* XRDHTTPUTILS_HH */