CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions
StatisticsSenderService.cc File Reference
#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.

Macros

#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)
 

Macro Definition Documentation

#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)
Value:
os << "\"" #x "\":" << (x-m_ ## x) << ", "; \
T x() const
Cartesian x coordinate.
#define 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.

Function Documentation

static X509* findEEC ( STACK_OF(X509)*  certstack)
static

Definition at line 269 of file StatisticsSenderService.cc.

References HLT_25ns14e33_v1_cff::depth, and customizeTrackingMonitorSeedNumber::idx.

Referenced by getX509SubjectFromFile().

269  {
270  int depth = sk_X509_num(certstack);
271  if (depth == 0) {
272  return nullptr;
273  }
274  int idx = depth-1;
275  char *priorsubject = nullptr;
276  char *subject = nullptr;
277  X509 *x509cert = sk_X509_value(certstack, idx);
278  for (; x509cert && idx>0; idx--) {
279  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
280  if (subject && priorsubject && (strncmp(subject, priorsubject, strlen(subject)) != 0)) {
281  break;
282  }
283  x509cert = sk_X509_value(certstack, idx);
284  if (subject) {
285  OPENSSL_free(subject);
286  subject = nullptr;
287  }
288  }
289  if (subject) {
290  OPENSSL_free(subject);
291  subject = nullptr;
292  }
293  return x509cert;
294 }
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
static bool getX509SubjectFromFile ( const std::string &  filename,
std::string &  result 
)
static

Definition at line 297 of file StatisticsSenderService.cc.

References data, findEEC(), mergeVDriftHistosByStation::name, and AlCaHLTBitMon_ParallelJobs::p.

Referenced by edm::storage::StatisticsSenderService::getX509Subject().

297  {
298  BIO *biof = nullptr;
299  STACK_OF(X509) *certs = nullptr;
300  char *subject = nullptr;
301  unsigned char *data = nullptr;
302  char *header = nullptr;
303  char *name = nullptr;
304  long len = 0U;
305 
306  if((biof = BIO_new_file(filename.c_str(), "r"))) {
307 
308  certs = sk_X509_new_null();
309  bool encountered_error = false;
310  while ((!encountered_error) && (!BIO_eof(biof)) && PEM_read_bio(biof, &name, &header, &data, &len)) {
311  if (strcmp(name, PEM_STRING_X509) == 0 || strcmp(name, PEM_STRING_X509_OLD) == 0) {
312  X509 * tmp_cert = nullptr;
313  // See WARNINGS section in http://www.openssl.org/docs/crypto/d2i_X509.html
314  // Without this cmsRun crashes on a mac with a valid grid proxy.
315  const unsigned char *p;
316  p=data;
317  tmp_cert = d2i_X509(&tmp_cert, &p, len);
318  if (tmp_cert) {
319  sk_X509_push(certs, tmp_cert);
320  } else {
321  encountered_error = true;
322  }
323  } // Note we ignore any proxy key in the file.
324  if (data) { OPENSSL_free(data); data = nullptr;}
325  if (header) { OPENSSL_free(header); header = nullptr;}
326  if (name) { OPENSSL_free(name); name = nullptr;}
327  }
328  X509 *x509cert = nullptr;
329  if (!encountered_error && sk_X509_num(certs)) {
330  x509cert = findEEC(certs);
331  }
332  if (x509cert) {
333  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
334  }
335  // Note we do not free x509cert directly, as it's still owned by the certs stack.
336  if (certs) {
337  sk_X509_pop_free(certs, X509_free);
338  x509cert = nullptr;
339  }
340  BIO_free(biof);
341  if (subject) {
342  result = subject;
343  OPENSSL_free(subject);
344  return true;
345  }
346  }
347  return false;
348 }
static X509 * findEEC(STACK_OF(X509)*certstack)
tuple result
Definition: query.py:137
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
tuple filename
Definition: lut2db_cfg.py:20