test
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 284 of file StatisticsSenderService.cc.

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

Referenced by getX509SubjectFromFile().

284  {
285  int depth = sk_X509_num(certstack);
286  if (depth == 0) {
287  return nullptr;
288  }
289  int idx = depth-1;
290  char *priorsubject = nullptr;
291  char *subject = nullptr;
292  X509 *x509cert = sk_X509_value(certstack, idx);
293  for (; x509cert && idx>0; idx--) {
294  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
295  if (subject && priorsubject && (strncmp(subject, priorsubject, strlen(subject)) != 0)) {
296  break;
297  }
298  x509cert = sk_X509_value(certstack, idx);
299  if (subject) {
300  OPENSSL_free(subject);
301  subject = nullptr;
302  }
303  }
304  if (subject) {
305  OPENSSL_free(subject);
306  subject = nullptr;
307  }
308  return x509cert;
309 }
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 312 of file StatisticsSenderService.cc.

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

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

312  {
313  BIO *biof = nullptr;
314  STACK_OF(X509) *certs = nullptr;
315  char *subject = nullptr;
316  unsigned char *data = nullptr;
317  char *header = nullptr;
318  char *name = nullptr;
319  long len = 0U;
320 
321  if((biof = BIO_new_file(filename.c_str(), "r"))) {
322 
323  certs = sk_X509_new_null();
324  bool encountered_error = false;
325  while ((!encountered_error) && (!BIO_eof(biof)) && PEM_read_bio(biof, &name, &header, &data, &len)) {
326  if (strcmp(name, PEM_STRING_X509) == 0 || strcmp(name, PEM_STRING_X509_OLD) == 0) {
327  X509 * tmp_cert = nullptr;
328  // See WARNINGS section in http://www.openssl.org/docs/crypto/d2i_X509.html
329  // Without this cmsRun crashes on a mac with a valid grid proxy.
330  const unsigned char *p;
331  p=data;
332  tmp_cert = d2i_X509(&tmp_cert, &p, len);
333  if (tmp_cert) {
334  sk_X509_push(certs, tmp_cert);
335  } else {
336  encountered_error = true;
337  }
338  } // Note we ignore any proxy key in the file.
339  if (data) { OPENSSL_free(data); data = nullptr;}
340  if (header) { OPENSSL_free(header); header = nullptr;}
341  if (name) { OPENSSL_free(name); name = nullptr;}
342  }
343  X509 *x509cert = nullptr;
344  if (!encountered_error && sk_X509_num(certs)) {
345  x509cert = findEEC(certs);
346  }
347  if (x509cert) {
348  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
349  }
350  // Note we do not free x509cert directly, as it's still owned by the certs stack.
351  if (certs) {
352  sk_X509_pop_free(certs, X509_free);
353  x509cert = nullptr;
354  }
355  BIO_free(biof);
356  if (subject) {
357  result = subject;
358  OPENSSL_free(subject);
359  return true;
360  }
361  }
362  return false;
363 }
static X509 * findEEC(STACK_OF(X509)*certstack)
tuple result
Definition: mps_fire.py:83
tuple filename
Definition: lut2db_cfg.py:20