35 const std::string& VomsProxySvc ::
38 static std::string result =
"VomsProxySvc";
45 testInvariant ()
const
58 const char *X509_USER_PROXY = getenv (
"X509_USER_PROXY");
62 file = X509_USER_PROXY;
65 std::ostringstream
str;
66 str <<
"/tmp/x509up_u" << getuid();
69 if (
file.empty() || gSystem->AccessPathName (
file.c_str()) !=
false)
73 std::ifstream stream (
file);
75 while (stream.get (ch))
81 return StatusCode::FAILURE;
86 const char *VomsProxySvc ::
90 return name().c_str();
101 int fd = open (m_fileName.c_str(), O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
104 auto myerrno = errno;
105 ANA_MSG_ERROR (
"failed to create file \"" << m_fileName <<
"\": " << strerror (myerrno));
106 return EL::StatusCode::FAILURE;
108 int written = write (fd, &m_proxyData[0], m_proxyData.size());
111 auto myerrno = errno;
112 ANA_MSG_ERROR (
"failed to write to file \"" << m_fileName <<
"\": " << strerror (myerrno));
114 return EL::StatusCode::FAILURE;
116 if (written <
int (m_proxyData.size()))
118 ANA_MSG_ERROR (
"only wrote " << written <<
" of " << m_proxyData.size() <<
" bytes to file \"" << m_fileName <<
"\"");
120 return EL::StatusCode::FAILURE;
122 if (close (fd) == -1)
124 auto myerrno = errno;
125 ANA_MSG_ERROR (
"failed to close file \"" << m_fileName <<
"\": " << strerror (myerrno));
126 return EL::StatusCode::FAILURE;
128 if (setenv (
"X509_USER_PROXY", m_fileName.c_str(),
true) == -1)
130 auto myerrno = errno;
131 ANA_MSG_ERROR (
"failed to set X509_USER_PROXY: " << strerror (myerrno));
132 return EL::StatusCode::FAILURE;
135 return EL::StatusCode::SUCCESS;
#define RCU_CHANGE_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
#define RCU_THROW_MSG(message)
ClassImp(EL::VomsProxySvc) namespace EL
This module defines the arguments passed from the BATCH driver to the BATCH worker.
::StatusCode StatusCode
StatusCode definition for legacy code.
void ensureVomsProxy()
ensure that we have a valid VOMS proxy available
bool checkVomsProxy()
return whether we have a valid VOMS proxy available