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) << ", "; \
#define UPDATE_STATISTIC(x)
Definition: DDAxes.h:10

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

References customizeTrackingMonitorSeedNumber::idx.

Referenced by getX509SubjectFromFile().

260  {
261  int depth = sk_X509_num(certstack);
262  if (depth == 0) {
263  return nullptr;
264  }
265  int idx = depth-1;
266  char *priorsubject = nullptr;
267  char *subject = nullptr;
268  X509 *x509cert = sk_X509_value(certstack, idx);
269  for (; x509cert && idx>0; idx--) {
270  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
271  if (subject && priorsubject && (strncmp(subject, priorsubject, strlen(subject)) != 0)) {
272  break;
273  }
274  x509cert = sk_X509_value(certstack, idx);
275  if (subject) {
276  OPENSSL_free(subject);
277  subject = nullptr;
278  }
279  }
280  if (subject) {
281  OPENSSL_free(subject);
282  subject = nullptr;
283  }
284  return x509cert;
285 }
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 288 of file StatisticsSenderService.cc.

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

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

288  {
289  BIO *biof = nullptr;
290  STACK_OF(X509) *certs = nullptr;
291  char *subject = nullptr;
292  unsigned char *data = nullptr;
293  char *header = nullptr;
294  char *name = nullptr;
295  long len = 0U;
296 
297  if((biof = BIO_new_file(filename.c_str(), "r"))) {
298 
299  certs = sk_X509_new_null();
300  bool encountered_error = false;
301  while ((!encountered_error) && (!BIO_eof(biof)) && PEM_read_bio(biof, &name, &header, &data, &len)) {
302  if (strcmp(name, PEM_STRING_X509) == 0 || strcmp(name, PEM_STRING_X509_OLD) == 0) {
303  X509 * tmp_cert = nullptr;
304  // See WARNINGS section in http://www.openssl.org/docs/crypto/d2i_X509.html
305  // Without this cmsRun crashes on a mac with a valid grid proxy.
306  const unsigned char *p;
307  p=data;
308  tmp_cert = d2i_X509(&tmp_cert, &p, len);
309  if (tmp_cert) {
310  sk_X509_push(certs, tmp_cert);
311  } else {
312  encountered_error = true;
313  }
314  } // Note we ignore any proxy key in the file.
315  if (data) { OPENSSL_free(data); data = nullptr;}
316  if (header) { OPENSSL_free(header); header = nullptr;}
317  if (name) { OPENSSL_free(name); name = nullptr;}
318  }
319  X509 *x509cert = nullptr;
320  if (!encountered_error && sk_X509_num(certs)) {
321  x509cert = findEEC(certs);
322  }
323  if (x509cert) {
324  subject = X509_NAME_oneline(X509_get_subject_name(x509cert),0,0);
325  }
326  // Note we do not free x509cert directly, as it's still owned by the certs stack.
327  if (certs) {
328  sk_X509_pop_free(certs, X509_free);
329  x509cert = nullptr;
330  }
331  BIO_free(biof);
332  if (subject) {
333  result = subject;
334  OPENSSL_free(subject);
335  return true;
336  }
337  }
338  return false;
339 }
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