#include <XrdTlsTempCA.hh>
Manages the temporary file associated with the curl handle
Definition at line 74 of file XrdTlsTempCA.hh.
◆ TempCAGuard()
XrdTlsTempCA::TempCAGuard::TempCAGuard |
( |
const TempCAGuard & |
| ) |
|
|
delete |
◆ ~TempCAGuard()
XrdTlsTempCA::TempCAGuard::~TempCAGuard |
( |
| ) |
|
◆ commit()
bool XrdTlsTempCA::TempCAGuard::commit |
( |
| ) |
|
Move temporary file to the permanent location.
Definition at line 308 of file XrdTlsTempCA.cc.
309 if (m_ca_fd < 0 || m_ca_tmp_dir.empty()) {
return false;}
312 std::string ca_fname = m_ca_tmp_dir +
"/ca_file.pem";
313 if (-1 ==
rename(m_ca_fname.c_str(), ca_fname.c_str())) {
316 m_ca_fname = ca_fname;
318 if (m_crl_fd < 0 || m_ca_tmp_dir.empty()) {
return false;}
321 std::string crl_fname = m_ca_tmp_dir +
"/crl_file.pem";
322 if (-1 ==
rename(m_crl_fname.c_str(), crl_fname.c_str())) {
325 m_crl_fname = crl_fname;
int rename(const char *oldpath, const char *newpath)
References close, and rename().
◆ create()
Definition at line 262 of file XrdTlsTempCA.cc.
264 if (-1 ==
mkdir(ca_tmp_dir.c_str(), S_IRWXU) && errno != EEXIST) {
265 err.
Emsg(
"TempCA",
"Unable to create CA temp directory", ca_tmp_dir.c_str(), strerror(errno));
268 std::stringstream ss;
269 ss << ca_tmp_dir <<
"/ca_file.XXXXXX.pem";
270 std::vector<char> ca_fname;
271 ca_fname.resize(ss.str().size() + 1);
272 memcpy(ca_fname.data(), ss.str().c_str(), ss.str().size());
274 int ca_fd = mkstemps(ca_fname.data(), 4);
276 err.
Emsg(
"TempCA",
"Failed to create temp file:", strerror(errno));
277 return std::unique_ptr<TempCAGuard>();
280 std::stringstream ss2;
281 ss2 << ca_tmp_dir <<
"/crl_file.XXXXXX.pem";
282 std::vector<char> crl_fname;
283 crl_fname.resize(ss2.str().size() + 1);
284 memcpy(crl_fname.data(), ss2.str().c_str(), ss2.str().size());
286 int crl_fd = mkstemps(crl_fname.data(), 4);
288 err.
Emsg(
"TempCA",
"Failed to create temp file:", strerror(errno));
289 return std::unique_ptr<TempCAGuard>();
291 return std::unique_ptr<TempCAGuard>(
new TempCAGuard(ca_fd, crl_fd, ca_tmp_dir, ca_fname.data(), crl_fname.data()));
int mkdir(const char *path, mode_t mode)
int Emsg(const char *esfx, int ecode, const char *text1, const char *text2=0)
TempCAGuard(const TempCAGuard &)=delete
References TempCAGuard(), XrdSysError::Emsg(), and mkdir().
◆ getCAFD()
int XrdTlsTempCA::TempCAGuard::getCAFD |
( |
| ) |
const |
|
inline |
◆ getCAFilename()
std::string XrdTlsTempCA::TempCAGuard::getCAFilename |
( |
| ) |
const |
|
inline |
◆ getCRLFD()
int XrdTlsTempCA::TempCAGuard::getCRLFD |
( |
| ) |
const |
|
inline |
◆ getCRLFilename()
std::string XrdTlsTempCA::TempCAGuard::getCRLFilename |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files: