Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/XrdHttpPelican.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ std::string Handler::m_ca_file;
std::string Handler::m_cert_file;
std::string Handler::m_cache_self_test_file;
std::string Handler::m_cache_self_test_file_cinfo;
std::string Handler::m_authfile_generated;
std::string Handler::m_scitokens_generated;
std::filesystem::path Handler::m_api_root{"/api/v1.0/pelican"};
decltype(Handler::m_acc) Handler::m_acc{nullptr};
decltype(Handler::m_is_cache) Handler::m_is_cache{false};
Expand Down Expand Up @@ -295,6 +297,24 @@ Handler::Handler(XrdSysError *log, const char *configfn, XrdOucEnv *xrdEnv)
"XRDHTTP_PELICAN_CACHE_SELF_TEST_FILE_CINFO environment "
"variable not set; cannot pass a cache self-test file cinfo");
}
auto authfile_generated_char =
getenv("XRDHTTP_PELICAN_AUTHFILE_GENERATED");
if (authfile_generated_char) {
m_authfile_generated = authfile_generated_char;
} else {
m_log.Emsg("PelicanHandler",
"XRDHTTP_PELICAN_AUTHFILE_GENERATED environment "
"variable not set; cannot update the authfile");
}
auto scitokens_generated_char =
getenv("XRDHTTP_PELICAN_SCITOKENS_GENERATED");
if (scitokens_generated_char) {
m_scitokens_generated = scitokens_generated_char;
} else {
m_log.Emsg("PelicanHandler",
"XRDHTTP_PELICAN_SCITOKENS_GENERATED environment "
"variable not set; cannot update the SciTokens");
}

if (configfn && strlen(configfn)) {
XrdOucGatherConf pelicanhandler_conf("pelican.", &m_log);
Expand Down Expand Up @@ -507,7 +527,7 @@ void Handler::ProcessMessage() {
"Failed to send signal to self:", strerror(errno));
}
return;
} else if (data != 1 && data != 2 && data != 4 && data != 5) {
} else if (data <= 0 || data > 7) {
m_log.Emsg("ProcessMessage", "Unknown control message from parent:",
std::to_string(data).c_str());
return;
Expand Down Expand Up @@ -535,6 +555,12 @@ void Handler::ProcessMessage() {
} else if (data == 5) {
// Pass a cache self test file cinfo
AtomicOverwriteFile(fd, m_cache_self_test_file_cinfo);
} else if (data == 6) {
// Pass an auth file
AtomicOverwriteFile(fd, m_authfile_generated);
} else if (data == 7) {
// Pass a scitokens file
AtomicOverwriteFile(fd, m_scitokens_generated);
} else {
m_log.Emsg("ProcessMessage", "Unknown message from parent:",
std::to_string(data).c_str());
Expand Down
6 changes: 6 additions & 0 deletions src/XrdHttpPelican.hh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ class Handler : public XrdHttpExtHandler {
// The location of the cache self-test file cinfo
static std::string m_cache_self_test_file_cinfo;

// The location of the generated auth file
static std::string m_authfile_generated;

// The location of the generated scitokens file
static std::string m_scitokens_generated;

// Send a SIGTERM to self, followed by a 5 second sleep, followed
// by a SIGKILL (until the process exits).
void ShutdownSelf();
Expand Down
Loading