From 2d20ec4782ae384df4bdef0cb58293d96174b376 Mon Sep 17 00:00:00 2001 From: Francesco Giacomini Date: Tue, 2 Apr 2024 12:26:35 +0200 Subject: [PATCH] Fix the parsing of the REST API XML response 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. --- src/common/xmlcc.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/xmlcc.cc b/src/common/xmlcc.cc index 6f9fe372..bd43f3f1 100644 --- a/src/common/xmlcc.cc +++ b/src/common/xmlcc.cc @@ -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")) { @@ -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;