CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 edm::storage::DavixFile::open().

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

Variable Documentation

std::once_flag davixDebugInit
static

Definition at line 14 of file DavixFile.cc.

Referenced by edm::storage::DavixFile::configureDavixLogLevel().