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

[XrdTls] The start of the CRLRefresh thread is now triggered in the constructor of the XrdTlsContext class #1791

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions src/XrdHttp/XrdHttpProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1685,13 +1685,13 @@ bool XrdHttpProtocol::InitTLS() {

std::string eMsg;
uint64_t opts = XrdTlsContext::servr | XrdTlsContext::logVF |
XrdTlsContext::artON;
XrdTlsContext::artON | XrdTlsContext::scRefr;

// Create a new TLS context
//
if (sslverifydepth > 255) sslverifydepth = 255;
opts = TLS_SET_VDEPTH(opts, sslverifydepth);
xrdctx = new XrdTlsContext(sslcert,sslkey,sslcadir,sslcafile,opts,&eMsg,true);
xrdctx = new XrdTlsContext(sslcert,sslkey,sslcadir,sslcafile,opts,&eMsg);

// Make sure the context was created
//
Expand Down
12 changes: 9 additions & 3 deletions src/XrdTls/XrdTlsContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ int VerCB(int aOK, X509_STORE_CTX *x509P)

XrdTlsContext::XrdTlsContext(const char *cert, const char *key,
const char *caDir, const char *caFile,
uint64_t opts, std::string *eMsg,const bool startCRLRefreshThread)
uint64_t opts, std::string *eMsg)
: pImpl( new XrdTlsContextImpl(this) )
{
class ctx_helper
Expand Down Expand Up @@ -726,7 +726,7 @@ XrdTlsContext::XrdTlsContext(const char *cert, const char *key,

// All went well, start the CRL refresh thread and keep the context.
//
if(startCRLRefreshThread) {
if(opts & scRefr) {
SetCrlRefresh();
}
ctx_tracker.Keep();
Expand Down Expand Up @@ -766,7 +766,13 @@ XrdTlsContext *XrdTlsContext::Clone(bool full,bool startCRLRefresh)

// Cloning simply means getting a object with the old parameters.
//
XrdTlsContext *xtc = new XrdTlsContext(cert, pkey, caD, caF, my.opts,nullptr,startCRLRefresh);
uint64_t myOpts = my.opts;
if(startCRLRefresh){
myOpts |= XrdTlsContext::scRefr;
} else {
myOpts &= ~XrdTlsContext::scRefr;
}
XrdTlsContext *xtc = new XrdTlsContext(cert, pkey, caD, caF, myOpts,nullptr);

// Verify that the context was built
//
Expand Down
3 changes: 2 additions & 1 deletion src/XrdTls/XrdTlsContext.hh
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ static const int scNone = 0x00000000; //!< Do not change any option settings
static const int scOff = 0x00010000; //!< Turn off cache
static const int scSrvr = 0x00020000; //!< Turn on cache server mode (default)
static const int scClnt = 0x00040000; //!< Turn on cache client mode
static const int scRefr = 0x20000000; //!< Turn on the CRL refresh thread
static const int scKeep = 0x40000000; //!< Info: TLS-controlled flush disabled
static const int scIdErr= 0x80000000; //!< Info: Id not set, is too long
static const int scFMax = 0x00007fff; //!< Maximum flush interval in seconds
Expand Down Expand Up @@ -238,7 +239,7 @@ static const uint64_t artON = 0x0000002000000000; //!< Auto retry Handshake

XrdTlsContext(const char *cert=0, const char *key=0,
const char *cadir=0, const char *cafile=0,
uint64_t opts=0, std::string *eMsg=0,const bool startCRLRefreshThread = false);
uint64_t opts=0, std::string *eMsg=0);

//------------------------------------------------------------------------
//! Destructor
Expand Down