#include <XrdTlsTempCA.hh>
Manages the temporary file associated with the curl handle
Definition at line 110 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 307 of file XrdTlsTempCA.cc.
308 if (m_ca_fd < 0 || m_ca_tmp_dir.empty()) {
return false;}
311 std::string ca_fname = m_ca_tmp_dir +
"/ca_file.pem";
312 if (-1 ==
rename(m_ca_fname.c_str(), ca_fname.c_str())) {
315 m_ca_fname = ca_fname;
317 if (m_crl_fd < 0 || m_ca_tmp_dir.empty()) {
return false;}
320 std::string crl_fname = m_ca_tmp_dir +
"/crl_file.pem";
321 if (-1 ==
rename(m_crl_fname.c_str(), crl_fname.c_str())) {
324 m_crl_fname = crl_fname;
int rename(const char *oldpath, const char *newpath)
References close, and rename().
◆ create()
Definition at line 261 of file XrdTlsTempCA.cc.
263 if (-1 ==
mkdir(ca_tmp_dir.c_str(), S_IRWXU) && errno != EEXIST) {
264 err.
Emsg(
"TempCA",
"Unable to create CA temp directory", ca_tmp_dir.c_str(), strerror(errno));
267 std::stringstream ss;
268 ss << ca_tmp_dir <<
"/ca_file.XXXXXX.pem";
269 std::vector<char> ca_fname;
270 ca_fname.resize(ss.str().size() + 1);
271 memcpy(ca_fname.data(), ss.str().c_str(), ss.str().size());
273 int ca_fd = mkstemps(ca_fname.data(), 4);
275 err.
Emsg(
"TempCA",
"Failed to create temp file:", strerror(errno));
276 return std::unique_ptr<TempCAGuard>();
279 std::stringstream ss2;
280 ss2 << ca_tmp_dir <<
"/crl_file.XXXXXX.pem";
281 std::vector<char> crl_fname;
282 crl_fname.resize(ss2.str().size() + 1);
283 memcpy(crl_fname.data(), ss2.str().c_str(), ss2.str().size());
285 int crl_fd = mkstemps(crl_fname.data(), 4);
287 err.
Emsg(
"TempCA",
"Failed to create temp file:", strerror(errno));
288 return std::unique_ptr<TempCAGuard>();
290 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: