Skip to content

Commit

Permalink
If a detailed error message is available, do not overwrite (#116)
Browse files Browse the repository at this point in the history
When verification of ACs fails, the prior behavior is to always have
this message:

```
Cannot verify AC signature!
```

This can be difficult to debug as there's no indication of whether
its a problem with the proxy itself or with the host configuration.

This patch appends the underlying error message if one was provided.
For example,

```
Cannot verify AC signature!  Underlying error: Certificate verification \
  failed for certificate '/CN=voms.example.com': certificate has expired.
```

(newlines added for readability)
  • Loading branch information
bbockelm authored Apr 26, 2023
1 parent 25b39ed commit 564dd86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api/ccapi/api_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,12 @@ vomsdata::verifydata(AC *ac, UNUSED(const std::string& subject),
issuer = check((void *)ac);

if (!issuer) {
seterror(VERR_SIGN, "Cannot verify AC signature!");
std::string oldmessage = ErrorMessage();
if (oldmessage.empty()) {
seterror(VERR_SIGN, "Cannot verify AC signature!");
} else {
seterror(VERR_SIGN, "Cannot verify AC signature! Underlying error: " + oldmessage);
}
return false;
}
}
Expand Down

0 comments on commit 564dd86

Please # to comment.