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 <cerrno>
#include <fcntl.h>
#include <cstdlib>
#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 109 of file DavixFile.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DavixFile::open().

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

Variable Documentation

std::once_flag davixDebugInit
static

Definition at line 14 of file DavixFile.cc.

Referenced by DavixFile::configureDavixLogLevel().