CMS 3D CMS Logo

Functions | Variables
DavixFile.cc File Reference
#include "Utilities/DavixAdaptor/interface/DavixFile.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/Utilities/interface/EDMException.h"
#include "FWCore/Utilities/interface/Exception.h"
#include <cassert>
#include <davix.hpp>
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
#include <vector>
#include <mutex>

Go to the source code of this file.

Functions

static int X509Authentication (void *userdata, const SessionInfo &info, X509Credential *cert, DavixError **davixErr)
 

Variables

static std::once_flag davixDebugInit
 

Function Documentation

static int X509Authentication ( void *  userdata,
const SessionInfo &  info,
X509Credential *  cert,
DavixError **  davixErr 
)
static

Definition at line 107 of file DavixFile.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DavixFile::open().

108  {
109  std::string ucert, ukey;
110  char default_proxy[64];
111  snprintf(default_proxy, sizeof(default_proxy), "/tmp/x509up_u%d", geteuid());
112  // X509_USER_PROXY
113  if (getenv("X509_USER_PROXY")) {
114  edm::LogInfo("DavixFile") << "X509_USER_PROXY found in environment."
115  << " Will use it for authentication";
116  ucert = ukey = getenv("X509_USER_PROXY");
117  }
118  // Default proxy location
119  else if (access(default_proxy, R_OK) == 0) {
120  edm::LogInfo("DavixFile") << "Found proxy in default location " << default_proxy
121  << " Will use it for authentication";
122  ucert = ukey = default_proxy;
123  }
124  // X509_USER_CERT
125  else if (getenv("X509_USER_CERT")) {
126  ucert = getenv("X509_USER_CERT");
127  }
128  // X509_USER_KEY only if X509_USER_CERT was found
129  if (!ucert.empty() && getenv("X509_USER_KEY")) {
130  edm::LogInfo("DavixFile") << "X509_USER_{CERT|KEY} found in environment"
131  << " Will use it for authentication";
132  ukey = getenv("X509_USER_KEY");
133  }
134  // Check if vars are set...
135  if (ucert.empty() || ukey.empty()) {
136  edm::LogWarning("DavixFile") << "Was not able to find proxy in $X509_USER_PROXY, "
137  << "X509_USER_{CERT|KEY} or default proxy creation location. "
138  << "Will try without authentication";
139  return -1;
140  }
141  return cert->loadFromFilePEM(ukey, ucert, "", davixErr);
142 }

Variable Documentation

std::once_flag davixDebugInit
static

Definition at line 14 of file DavixFile.cc.

Referenced by DavixFile::configureDavixLogLevel().