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

XrdTlsContext: Recreate session cache in the Clone() method #1875

Merged
Changes from all commits
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
13 changes: 12 additions & 1 deletion src/XrdTls/XrdTlsContext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ struct XrdTlsContextImpl
bool crlRunning;
bool flsRunning;
time_t lastCertModTime = 0;
int sessionCacheOpts = -1;
std::string sessionCacheId;
};

/******************************************************************************/
Expand Down Expand Up @@ -779,7 +781,13 @@ XrdTlsContext *XrdTlsContext::Clone(bool full,bool startCRLRefresh)

// Verify that the context was built
//
if (xtc->isOK()) return xtc;
if (xtc->isOK()) {
if(pImpl->sessionCacheOpts != -1){
//A SessionCache() call was done for the current context, so apply it for this new cloned context
xtc->SessionCache(pImpl->sessionCacheOpts,pImpl->sessionCacheId.c_str(),pImpl->sessionCacheId.size());
}
return xtc;
}

// We failed, cleanup.
//
Expand Down Expand Up @@ -940,6 +948,9 @@ int XrdTlsContext::SessionCache(int opts, const char *id, int idlen)
long sslopt = 0;
int flushT = opts & scFMax;

pImpl->sessionCacheOpts = opts;
pImpl->sessionCacheId = id;

// If initialization failed there is nothing to do
//
if (pImpl->ctx == 0) return 0;
Expand Down