#include "Utilities/StorageFactory/interface/StatisticsSenderService.h"
#include "Utilities/StorageFactory/interface/StorageAccount.h"
#include "FWCore/ServiceRegistry/interface/ActivityRegistry.h"
#include "FWCore/Catalog/interface/SiteLocalConfig.h"
#include "FWCore/ServiceRegistry/interface/Service.h"
#include "FWCore/Utilities/src/Guid.h"
#include <string>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <openssl/x509.h>
#include <openssl/pem.h>
Go to the source code of this file.
Defines | |
#define | HOST_NAME_MAX 128 |
#define | JOB_UNIQUE_ID_ENV "CRAB_UNIQUE_JOB_ID" |
#define | JOB_UNIQUE_ID_ENV_V2 "DashboardJobId" |
#define | UPDATE_AND_OUTPUT_STATISTIC(x) |
#define | UPDATE_STATISTIC(x) m_ ## x = x; |
Functions | |
static X509 * | findEEC (STACK_OF(X509)*certstack) |
static bool | getX509SubjectFromFile (const std::string &filename, std::string &result) |
#define HOST_NAME_MAX 128 |
Definition at line 28 of file StatisticsSenderService.cc.
Referenced by edm::storage::StatisticsSenderService::determineHostnames().
#define JOB_UNIQUE_ID_ENV "CRAB_UNIQUE_JOB_ID" |
Definition at line 31 of file StatisticsSenderService.cc.
Referenced by edm::storage::StatisticsSenderService::getJobID().
#define JOB_UNIQUE_ID_ENV_V2 "DashboardJobId" |
Definition at line 32 of file StatisticsSenderService.cc.
Referenced by edm::storage::StatisticsSenderService::getJobID().
#define UPDATE_AND_OUTPUT_STATISTIC | ( | x | ) |
os << "\"" #x "\":" << (x-m_ ## x) << ", "; \ UPDATE_STATISTIC(x)
Definition at line 21 of file StatisticsSenderService.cc.
Referenced by edm::storage::StatisticsSenderService::FileStatistics::fillUDP().
#define UPDATE_STATISTIC | ( | x | ) | m_ ## x = x; |
Definition at line 18 of file StatisticsSenderService.cc.
static X509* findEEC | ( | STACK_OF(X509)* | certstack | ) | [static] |
Definition at line 260 of file StatisticsSenderService.cc.
References customizeTrackingMonitorSeedNumber::idx.
Referenced by getX509SubjectFromFile().
{ int depth = sk_X509_num(certstack); if (depth == 0) { return nullptr; } int idx = depth-1; char *priorsubject = nullptr; char *subject = nullptr; X509 *x509cert = sk_X509_value(certstack, idx); for (; x509cert && idx>0; idx--) { subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0); if (subject && priorsubject && (strncmp(subject, priorsubject, strlen(subject)) != 0)) { break; } x509cert = sk_X509_value(certstack, idx); if (subject) { OPENSSL_free(subject); subject = nullptr; } } if (subject) { OPENSSL_free(subject); subject = nullptr; } return x509cert; }
static bool getX509SubjectFromFile | ( | const std::string & | filename, |
std::string & | result | ||
) | [static] |
Definition at line 288 of file StatisticsSenderService.cc.
References data, findEEC(), mergeVDriftHistosByStation::name, and AlCaHLTBitMon_ParallelJobs::p.
Referenced by edm::storage::StatisticsSenderService::getX509Subject().
{ BIO *biof = nullptr; STACK_OF(X509) *certs = nullptr; char *subject = nullptr; unsigned char *data = nullptr; char *header = nullptr; char *name = nullptr; long len = 0U; if((biof = BIO_new_file(filename.c_str(), "r"))) { certs = sk_X509_new_null(); bool encountered_error = false; while ((!encountered_error) && (!BIO_eof(biof)) && PEM_read_bio(biof, &name, &header, &data, &len)) { if (strcmp(name, PEM_STRING_X509) == 0 || strcmp(name, PEM_STRING_X509_OLD) == 0) { X509 * tmp_cert = nullptr; // See WARNINGS section in http://www.openssl.org/docs/crypto/d2i_X509.html // Without this cmsRun crashes on a mac with a valid grid proxy. const unsigned char *p; p=data; tmp_cert = d2i_X509(&tmp_cert, &p, len); if (tmp_cert) { sk_X509_push(certs, tmp_cert); } else { encountered_error = true; } } // Note we ignore any proxy key in the file. if (data) { OPENSSL_free(data); data = nullptr;} if (header) { OPENSSL_free(header); header = nullptr;} if (name) { OPENSSL_free(name); name = nullptr;} } X509 *x509cert = nullptr; if (!encountered_error && sk_X509_num(certs)) { x509cert = findEEC(certs); } if (x509cert) { subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0); } // Note we do not free x509cert directly, as it's still owned by the certs stack. if (certs) { sk_X509_pop_free(certs, X509_free); x509cert = nullptr; } BIO_free(biof); if (subject) { result = subject; OPENSSL_free(subject); return true; } } return false; }