Skip to content

Commit

Permalink
Fix the parsing of the REST API XML response
Browse files Browse the repository at this point in the history
The depth of some fields was not correct for the response obtained
through the REST API, which is the first one tried and the only one that
will survive in the future with VOMS-AA.

In addition, VOMS-AA returns a numeric code for an error condition, not
a string like VOMS server.
  • Loading branch information
giacomini committed Apr 2, 2024
1 parent 425a99b commit 2d20ec4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/common/xmlcc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ static void endans(void *userdata, const char *name)
a->num = atoi(a->value.c_str());
}
else if ((!strcmp(name, "message")) &&
(a->depth == 3)) {
(a->depth == 3 || a->depth == 2)) {
a->message = a->value;
}
else if (!strcmp(name, "warning")) {
Expand All @@ -501,10 +501,10 @@ static void endans(void *userdata, const char *name)
a->a->errs.push_back(e);
}
else if ((!strcmp(name, "code")) &&
(a->depth == 3)) {
(a->depth == 2)) {
const char *msg = a->value.c_str();

if (!strcmp(msg, "NoSuchUser"))
if (!strcmp(msg, "NoSuchUser") || atoi(msg) == ERR_NOT_MEMBER)
a->num = ERR_NOT_MEMBER;
else if (!strcmp(msg, "SuspendedUser"))
a->num = ERR_SUSPENDED;
Expand Down

0 comments on commit 2d20ec4

Please sign in to comment.