From 505ebad19f1ee39bd4fce51c5c5f31f12615596b Mon Sep 17 00:00:00 2001 From: Gerardo Ganis Date: Mon, 18 Jun 2018 18:09:12 +0200 Subject: [PATCH] secgsi: improving checking of CA expiration --- src/XrdSecgsi/XrdSecProtocolgsi.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/XrdSecgsi/XrdSecProtocolgsi.cc b/src/XrdSecgsi/XrdSecProtocolgsi.cc index 2836385b0a9..3dd8a39864a 100644 --- a/src/XrdSecgsi/XrdSecProtocolgsi.cc +++ b/src/XrdSecgsi/XrdSecProtocolgsi.cc @@ -4108,6 +4108,15 @@ bool XrdSecProtocolgsi::VerifyCA(int opt, X509Chain *cca, XrdCryptoFactory *CF) // Point to the certificate XrdCryptoX509 *xc = cca->Begin(); + if (!xc) { + PRINT("Cannot attach to first certificate in chain"); + return 0; + } + // Make sure it is valid + if (!(xc->IsValid())) { + PRINT("CA certificate is expired ("<SubjectHash()<<", not_before: "<NotBefore()<<" secs UTC )"); + return 0; + } // Is it self-signed ? bool self = (!strcmp(xc->IssuerHash(), xc->SubjectHash())) ? 1 : 0; if (!self) {