CMS 3D CMS Logo

Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
cond Namespace Reference

Namespaces

 auth
 
 payloadInspector
 
 persistency
 
 RelationalAuthenticationService
 
 serialization
 
 service
 
 time
 
 XMLAuthenticationService
 

Classes

struct  AuthorizationData
 
class  BaseKeyed
 
class  BasicPayload
 
class  Binary
 
class  BTransitionAnalyzer
 
class  CoralServiceFactory
 
class  CoralServiceManager
 
struct  CoralServiceWrapper
 
struct  CoralServiceWrapperBase
 
struct  CredentialData
 
class  CredentialStore
 
class  CSScopedSession
 
class  DataProxyWrapperBase
 
struct  DefaultInitializer
 
class  EmptyIOVSource
 
class  FileReader
 
class  GenericSummary
 
class  GTEntry_t
 
struct  GTMetadata_t
 
struct  Iov_t
 
class  IOVDescription
 
class  IOVKeysDescription
 
class  IOVProvenance
 
class  IOVUserMetaData
 
class  KeyedElement
 
struct  LessFrame
 
struct  LogDBEntry_t
 
struct  PrincipalData
 
struct  RealTimeType
 
struct  RealTimeType< hash >
 
struct  RealTimeType< lumiid >
 
struct  RealTimeType< runnumber >
 
struct  RealTimeType< timestamp >
 
struct  RealTimeType< userid >
 
struct  RunInfo_t
 
class  SmallWORMDict
 
class  StreamerInfo
 
class  Summary
 
struct  Tag_t
 
struct  TagInfo_t
 
struct  TagMetadata_t
 
struct  TimeTypeSpecs
 
struct  TimeTypeTraits
 
class  UnregisteredRecordException
 
struct  UserLogInfo
 
class  Utilities
 
class  UtilitiesError
 

Typedefs

typedef cond::serialization::InputArchive CondInputArchive
 
typedef cond::serialization::OutputArchive CondOutputArchive
 
typedef edmplugin::PluginFactory< cond::CoralServiceWrapperBase *()> CoralServicePluginFactory
 
typedef persistency::Exception Exception
 
typedef std::string Hash
 
typedef edmplugin::PluginFactory< cond::DataProxyWrapperBase *()> ProxyFactory
 
typedef TagInfo_t TagInfo
 
typedef unsigned long long Time_t
 
typedef unsigned long long uint64_t
 
typedef std::pair< unsigned int, unsigned int > UnpackedTime
 
typedef std::pair< Time_t, Time_tValidityInterval
 

Enumerations

enum  SynchronizationType {
  SYNCH_ANY = 0, SYNCH_VALIDATION, SYNCH_OFFLINE, SYNCH_MC,
  SYNCH_RUNMC, SYNCH_HLT, SYNCH_EXPRESS, SYNCH_PROMPT,
  SYNCH_PCL
}
 
enum  TimeType {
  invalid = -1, runnumber = 0, timestamp, lumiid,
  hash, userid
}
 

Functions

std::string classNameForTypeId (const std::type_info &typeInfo)
 
template<typename T >
TcreatePayload (const std::string &payloadTypeName)
 
template<>
HcalCalibrationQIEDatacreatePayload< HcalCalibrationQIEData > (const std::string &payloadTypeName)
 
template<>
std::string * createPayload< std::string > (const std::string &payloadTypeName)
 
template<typename T >
std::unique_ptr< Tdefault_deserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<typename T >
std::unique_ptr< Tdeserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< BaseKeyeddeserialize< BaseKeyed > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< condex::Efficiencydeserialize< condex::Efficiency > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< CSCReadoutMappingdeserialize< CSCReadoutMapping > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< CSCReadoutMappingForSliceTestdeserialize< CSCReadoutMappingForSliceTest > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::unique_ptr< PerformancePayloaddeserialize< PerformancePayload > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
const TimeTypeSpecsfindSpecs (std::string const &name)
 
int getch ()
 
std::string getLoginName ()
 
bool getNextSequenceValue (coral::ISchema &schema, const std::string &sequenceName, int &value)
 
std::string getpass (const std::string &prompt, bool show_asterisk=true)
 
std::string getpassForUser (const std::string &userName)
 
unsigned long long hash64 (unsigned char *k, unsigned long long length, unsigned long long level)
 
const Time_t invalidTime (0)
 
const std::string invalidToken (" ")
 
Iov_t makeIov (cond::Time_t since, const Hash &payloadId)
 
void parseLineForNamedParams (const std::string &line, std::map< std::string, std::string > &params)
 
const char * pluginCategory ()
 
char randomChar ()
 
std::string schemaLabel (const std::string &serviceName, const std::string &userName)
 
std::string schemaLabelForCredentialStore (const std::string &connectionString)
 
bool selectAuthorization (coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
 
bool selectConnection (coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
 
bool selectPrincipal (coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
 
template<typename T >
std::pair< Binary, Binaryserialize (const T &payload)
 
bool setPermissionData (coral::ISchema &schema, int principalId, const std::string &principalKey, const std::string &role, const std::string &connectionString, int connectionId, const std::string &connectionKey)
 
SynchronizationType synchronizationTypeFromName (const std::string &name)
 
std::string synchronizationTypeNames (SynchronizationType type)
 
void throwException (const std::string &message, const std::string &methodName)
 
const Time_t TIMELIMIT (std::numeric_limits< Time_t >::max())
 
std::string const & timeTypeNames (int)
 
std::pair< int, std::string > updateConnectionData (coral::ISchema &schema, const std::string &adminKey, const std::string &connectionLabel, const std::string &userName, const std::string &password, bool forceUpdate)
 
std::pair< int, std::string > updatePrincipalData (coral::ISchema &schema, const std::string &authenticationKey, const std::string &principalName, const std::string &adminKey, bool init=false)
 

Variables

static constexpr unsigned int HASH_SIZE = 40
 
static std::pair< const char *, SynchronizationTypes_obsoleteSynchronizationTypeArray []
 
static std::pair< const char *, SynchronizationTypes_synchronizationTypeArray []
 
const unsigned int TIMETYPE_LIST_MAX = 5
 
const cond::TimeType timeTypeList [TIMETYPE_LIST_MAX] = {runnumber, timestamp, lumiid, hash, userid}
 
const TimeTypeSpecs timeTypeSpecs []
 
const cond::TimeType timeTypeValues [] = {runnumber, timestamp, lumiid, hash, userid}
 

Detailed Description

The wrapper is used to allow edm::PluginFactory to change its return type to unique_ptr from a raw pointer. The unique_ptr does not work for coral::Service, because its destructor is protected and ownership is managed by intrusive reference counting.

Serialization.h CondCore/CondDB/interface/Serialization.h Description: functions for serializing the payload objects.

Typedef Documentation

Definition at line 61 of file Serialization.h.

Definition at line 62 of file Serialization.h.

Definition at line 25 of file CoralServiceFactory.h.

Definition at line 25 of file Exception.h.

typedef std::string cond::Hash

Definition at line 43 of file Types.h.

Definition at line 29 of file ProxyFactory.h.

Definition at line 80 of file Types.h.

typedef unsigned long long cond::Time_t

Definition at line 14 of file Time.h.

typedef unsigned long long cond::uint64_t

Definition at line 13 of file Time.h.

typedef std::pair<unsigned int, unsigned int> cond::UnpackedTime

Definition at line 15 of file Time.h.

typedef std::pair<Time_t, Time_t> cond::ValidityInterval

Definition at line 17 of file Time.h.

Enumeration Type Documentation

Enumerator
SYNCH_ANY 
SYNCH_VALIDATION 
SYNCH_OFFLINE 
SYNCH_MC 
SYNCH_RUNMC 
SYNCH_HLT 
SYNCH_EXPRESS 
SYNCH_PROMPT 
SYNCH_PCL 

Definition at line 27 of file Types.h.

Enumerator
invalid 
runnumber 
timestamp 
lumiid 
hash 
userid 

Definition at line 19 of file Time.h.

Function Documentation

std::string cond::classNameForTypeId ( const std::type_info &  typeInfo)
inline

Definition at line 29 of file PoolDBOutputService.h.

References edm::TypeID::className().

29  {
30  edm::TypeID type(typeInfo);
31  return type.className();
32  }
type
Definition: HCALResponse.h:21
template<typename T >
T* cond::createPayload ( const std::string &  payloadTypeName)

Definition at line 31 of file Serialization.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

31  {
32  std::string userTypeName = demangledName(typeid(T));
33  if (userTypeName != payloadTypeName)
35  std::string("Type mismatch, user type: \"" + userTypeName + "\", target type: \"") + payloadTypeName + "\"",
36  "createPayload");
37  return new T;
38  }
long double T
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
HcalCalibrationQIEData* cond::createPayload< HcalCalibrationQIEData > ( const std::string &  payloadTypeName)

Definition at line 37 of file plugin.cc.

References MillePedeFileConverter_cfg::e, HcalFrontEndMap::initialize(), HcalSiPMCharacteristics::initialize(), HcalElectronicsMap::initialize(), HcalDcsMap::initialize(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

37  {
38  if (payloadTypeName == "HcalCalibrationQIEData")
39  return new HcalCalibrationQIEData(nullptr);
40  throwException(std::string("Type mismatch, target object is type \"") + payloadTypeName + "\"", "createPayload");
41  }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
std::string* cond::createPayload< std::string > ( const std::string &  payloadTypeName)
inline

Definition at line 41 of file Serialization.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

41  {
42  std::string userTypeName = demangledName(typeid(std::string));
43  if (payloadTypeName != userTypeName && payloadTypeName != "std::string")
44  throwException(std::string("Type mismatch, user type: \"std::string\", target type: \"") + payloadTypeName + "\"",
45  "createPayload");
46  return new std::string;
47  }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<typename T >
std::unique_ptr<T> cond::default_deserialize ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 86 of file Serialization.h.

References cond::Binary::data(), MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, jets_cff::payload, cond::Binary::size(), AlCaHLTBitMon_QueryRunRegistry::string, cond::StreamerInfo::techVersion(), and throwException().

88  {
89  std::unique_ptr<T> payload;
90  std::stringbuf sstreamerInfoBuf;
91  sstreamerInfoBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(streamerInfoData.data())), streamerInfoData.size());
92  std::string streamerInfo = sstreamerInfoBuf.str();
93  try {
94  std::stringbuf sdataBuf;
95  sdataBuf.pubsetbuf(static_cast<char*>(const_cast<void*>(payloadData.data())), payloadData.size());
96  std::istream dataBuffer(&sdataBuf);
97  CondInputArchive ia(dataBuffer);
98  payload.reset(createPayload<T>(payloadType));
99  ia >> (*payload);
100  } catch (const std::exception& e) {
101  std::string errorMsg("De-serialization failed: ");
102  std::string em(e.what());
103  if (em == "unsupported version") {
104  errorMsg += "the current boost version (" + StreamerInfo::techVersion() +
105  ") is unable to read the payload. Data might have been serialized with an incompatible version.";
106  } else if (em == "input stream error") {
107  errorMsg += "data size does not fit with the current class layout. The Class " + payloadType +
108  " might have been changed with respect to the layout used in the upload.";
109  } else {
110  errorMsg += em;
111  }
112  if (!streamerInfo.empty())
113  errorMsg += " Payload serialization info: " + streamerInfo;
114  throwException(errorMsg, "default_deserialize");
115  }
116  return payload;
117  }
cond::serialization::InputArchive CondInputArchive
Definition: Serialization.h:61
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<typename T >
std::unique_ptr<T> cond::deserialize ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 121 of file Serialization.h.

References HLT_2018_cff::payloadType.

123  {
124  return default_deserialize<T>(payloadType, payloadData, streamerInfoData);
125  }
template<>
std::unique_ptr< BaseKeyed > cond::deserialize< BaseKeyed > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 39 of file plugin.cc.

References DESERIALIZE_BASE_CASE, DESERIALIZE_POLIMORPHIC_CASE, MillePedeFileConverter_cfg::e, condex::Efficiency::initialize(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

41  {
42  DESERIALIZE_BASE_CASE(BaseKeyed);
45 
46  // here we come if none of the deserializations above match the payload type:
47  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
48  }
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
#define DESERIALIZE_BASE_CASE(BASETYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
std::unique_ptr<condex::Efficiency> cond::deserialize< condex::Efficiency > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 25 of file plugin.cc.

References DESERIALIZE_POLIMORPHIC_CASE, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

27  {
28  // DESERIALIZE_BASE_CASE( condex::Efficiency ); abstract
31 
32  // here we come if none of the deserializations above match the payload type:
33  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
34  }
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
std::unique_ptr<CSCReadoutMapping> cond::deserialize< CSCReadoutMapping > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 65 of file plugin.cc.

References DESERIALIZE_POLIMORPHIC_CASE, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

67  {
68  // DESERIALIZE_BASE_CASE( CSCReadoutMapping ); abstract
70  // here we come if none of the deserializations above match the payload type:
71  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
72  }
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
std::unique_ptr<CSCReadoutMappingForSliceTest> cond::deserialize< CSCReadoutMappingForSliceTest > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 74 of file plugin.cc.

References DESERIALIZE_POLIMORPHIC_CASE, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

75  {
76  // DESERIALIZE_BASE_CASE( CSCReadoutMappingForSliceTest ); abstract
78  // here we come if none of the deserializations above match the payload type:
79  throwException(std::string("Type mismatch, target object is type \"") + payloadType + "\"", "deserialize<>");
80  }
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
template<>
std::unique_ptr<PerformancePayload> cond::deserialize< PerformancePayload > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)
const TimeTypeSpecs & cond::findSpecs ( std::string const &  name)

Definition at line 23 of file Time.cc.

References Exception, mps_fire::i, and TIMETYPE_LIST_MAX.

Referenced by cond::TimeTypeTraits< type >::specs(), and cond::time::timeTypeFromName().

23  {
24  size_t i = 0;
25  for (; i < TIMETYPE_LIST_MAX; i++)
26  if (name == timeTypeSpecs[i].name)
27  return timeTypeSpecs[i];
28  throw cms::Exception("invalid timetype: " + name);
29  return timeTypeSpecs[0]; // compiler happy
30  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:16
const unsigned int TIMETYPE_LIST_MAX
Definition: Time.h:20
int cond::getch ( )

Definition at line 19 of file Utilities.cc.

Referenced by getpass().

19  {
20  int ch;
21  struct termios t_old, t_new;
22 
23  tcgetattr(STDIN_FILENO, &t_old);
24  t_new = t_old;
25  t_new.c_lflag &= ~(ICANON | ECHO);
26  tcsetattr(STDIN_FILENO, TCSANOW, &t_new);
27 
28  ch = getchar();
29 
30  tcsetattr(STDIN_FILENO, TCSANOW, &t_old);
31  return ch;
32  }
std::string cond::getLoginName ( )

Definition at line 41 of file DecodingKey.cc.

References mps_check::msg, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by cond::auth::DecodingKey::init().

41  {
42  std::string loginName("");
43  struct passwd* userp = ::getpwuid(::getuid());
44  if (userp) {
45  char* uName = userp->pw_name;
46  if (uName) {
47  loginName += uName;
48  }
49  }
50  if (loginName.empty()) {
51  std::string msg("Cannot determine login name.");
52  throwException(msg, "DecodingKey::getLoginName");
53  }
54  return loginName;
55  }
tuple msg
Definition: mps_check.py:285
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
bool cond::getNextSequenceValue ( coral::ISchema &  schema,
const std::string &  sequenceName,
int &  value 
)

Definition at line 308 of file CredentialStore.cc.

References contentValuesFiles::query, runTheMatrix::ret, SEQUENCE_NAME_COL(), SEQUENCE_TABLE_NAME(), SEQUENCE_VALUE_COL(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setPermissionData(), updateConnectionData(), and updatePrincipalData().

308  {
309  bool ret = false;
310  std::unique_ptr<coral::IQuery> query(schema.tableHandle(SEQUENCE_TABLE_NAME).newQuery());
311  query->limitReturnedRows(1, 0);
312  query->addToOutputList(SEQUENCE_VALUE_COL);
313  query->defineOutputType(SEQUENCE_VALUE_COL, coral::AttributeSpecification::typeNameForType<int>());
314  query->setForUpdate();
315  std::string whereClause(SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL);
316  coral::AttributeList rowData;
317  rowData.extend<std::string>(SEQUENCE_NAME_COL);
318  rowData.begin()->data<std::string>() = sequenceName;
319  query->setCondition(whereClause, rowData);
320  coral::ICursor& cursor = query->execute();
321  if (cursor.next()) {
322  value = cursor.currentRow().begin()->data<int>() + 1;
323  ret = true;
324  } else {
325  return false;
326  }
327  // update...
328  coral::AttributeList updateData;
329  updateData.extend<std::string>(SEQUENCE_NAME_COL);
330  updateData.extend<int>(SEQUENCE_VALUE_COL);
331  std::string setClause(SEQUENCE_VALUE_COL + " = :" + SEQUENCE_VALUE_COL);
332  std::string whClause(SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL);
333  coral::AttributeList::iterator iAttribute = updateData.begin();
334  iAttribute->data<std::string>() = sequenceName;
335  ++iAttribute;
336  iAttribute->data<int>() = value;
337  schema.tableHandle(SEQUENCE_TABLE_NAME).dataEditor().updateRows(setClause, whClause, updateData);
338  return ret;
339  }
static const std::string SEQUENCE_VALUE_COL("VALUE")
ret
prodAgent to be discontinued
static const std::string SEQUENCE_TABLE_NAME("COND_CREDENTIAL_SEQUENCE")
Definition: query.py:1
static const std::string SEQUENCE_NAME_COL("NAME")
Definition: value.py:1
std::string cond::getpass ( const std::string &  prompt,
bool  show_asterisk = true 
)

Definition at line 34 of file Utilities.cc.

References gather_cfg::cout, getch(), EcalCondDBWriter_cfi::password, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by getpassForUser().

34  {
35  const char BACKSPACE = 127;
36  const char RETURN = 10;
37 
39  unsigned char ch = 0;
40 
41  std::cout << prompt;
42 
43  while ((ch = getch()) != RETURN) {
44  if (ch == BACKSPACE) {
45  if (password.length() != 0) {
46  if (show_asterisk)
47  std::cout << "\b \b";
48  password.resize(password.length() - 1);
49  }
50  } else {
51  password += ch;
52  if (show_asterisk)
53  std::cout << '*';
54  }
55  }
56  std::cout << std::endl;
57  return password;
58  }
int getch()
Definition: Utilities.cc:19
std::string cond::getpassForUser ( const std::string &  userName)

Definition at line 60 of file Utilities.cc.

References getpass(), AlCaHLTBitMon_QueryRunRegistry::string, and EcalCondDBWriter_cfi::userName.

60  {
61  std::string prompt("Enter password for user ");
62  prompt += userName;
63  prompt += ": ";
64  return getpass(prompt, true);
65  }
std::string getpass(const std::string &prompt, bool show_asterisk=true)
Definition: Utilities.cc:34
ub8 cond::hash64 ( unsigned char *  k,
unsigned long long  length,
unsigned long long  level 
)

Definition at line 68 of file hash64.cc.

References a, b, HltBtagPostValidation_cff::c, personalPlayback::level, L1DTConfigBti_cff::LL, and mix64.

Referenced by cond::KeyedElement::convert().

72  {
73  ub8 a, b, c, len;
74 
75  /* Set up the internal state */
76  len = length;
77  a = b = level; /* the previous hash value */
78  c = 0x9e3779b97f4a7c13LL; /* the golden ratio; an arbitrary value */
79 
80  /*---------------------------------------- handle most of the key */
81  if (((unsigned long)k) & 7) {
82  while (len >= 24) {
83  a += (k[0] + ((ub8)k[1] << 8) + ((ub8)k[2] << 16) + ((ub8)k[3] << 24) + ((ub8)k[4] << 32) + ((ub8)k[5] << 40) +
84  ((ub8)k[6] << 48) + ((ub8)k[7] << 56));
85  b += (k[8] + ((ub8)k[9] << 8) + ((ub8)k[10] << 16) + ((ub8)k[11] << 24) + ((ub8)k[12] << 32) +
86  ((ub8)k[13] << 40) + ((ub8)k[14] << 48) + ((ub8)k[15] << 56));
87  c += (k[16] + ((ub8)k[17] << 8) + ((ub8)k[18] << 16) + ((ub8)k[19] << 24) + ((ub8)k[20] << 32) +
88  ((ub8)k[21] << 40) + ((ub8)k[22] << 48) + ((ub8)k[23] << 56));
89  mix64(a, b, c);
90  k += 24;
91  len -= 24;
92  }
93  } else {
94  while (len >= 24) /* aligned */
95  {
96  a += *(ub8 *)(k + 0);
97  b += *(ub8 *)(k + 8);
98  c += *(ub8 *)(k + 16);
99  mix64(a, b, c);
100  k += 24;
101  len -= 24;
102  }
103  }
104 
105  /*------------------------------------- handle the last 23 bytes */
106  c += length;
107  switch (len) /* all the case statements fall through */
108  {
109  case 23:
110  c += ((ub8)k[22] << 56);
111  [[fallthrough]];
112  case 22:
113  c += ((ub8)k[21] << 48);
114  [[fallthrough]];
115  case 21:
116  c += ((ub8)k[20] << 40);
117  [[fallthrough]];
118  case 20:
119  c += ((ub8)k[19] << 32);
120  [[fallthrough]];
121  case 19:
122  c += ((ub8)k[18] << 24);
123  [[fallthrough]];
124  case 18:
125  c += ((ub8)k[17] << 16);
126  [[fallthrough]];
127  case 17:
128  c += ((ub8)k[16] << 8);
129  [[fallthrough]];
130  /* the first byte of c is reserved for the length */
131  case 16:
132  b += ((ub8)k[15] << 56);
133  [[fallthrough]];
134  case 15:
135  b += ((ub8)k[14] << 48);
136  [[fallthrough]];
137  case 14:
138  b += ((ub8)k[13] << 40);
139  [[fallthrough]];
140  case 13:
141  b += ((ub8)k[12] << 32);
142  [[fallthrough]];
143  case 12:
144  b += ((ub8)k[11] << 24);
145  [[fallthrough]];
146  case 11:
147  b += ((ub8)k[10] << 16);
148  [[fallthrough]];
149  case 10:
150  b += ((ub8)k[9] << 8);
151  [[fallthrough]];
152  case 9:
153  b += ((ub8)k[8]);
154  [[fallthrough]];
155  case 8:
156  a += ((ub8)k[7] << 56);
157  [[fallthrough]];
158  case 7:
159  a += ((ub8)k[6] << 48);
160  [[fallthrough]];
161  case 6:
162  a += ((ub8)k[5] << 40);
163  [[fallthrough]];
164  case 5:
165  a += ((ub8)k[4] << 32);
166  [[fallthrough]];
167  case 4:
168  a += ((ub8)k[3] << 24);
169  [[fallthrough]];
170  case 3:
171  a += ((ub8)k[2] << 16);
172  [[fallthrough]];
173  case 2:
174  a += ((ub8)k[1] << 8);
175  [[fallthrough]];
176  case 1:
177  a += ((ub8)k[0]);
178  /* case 0: nothing left to add */
179  }
180  mix64(a, b, c);
181  /*-------------------------------------------- report the result */
182  return c;
183  }
#define mix64(a, b, c)
Definition: hash64.cc:22
unsigned long long ub8
Definition: hash64.cc:62
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
const Time_t cond::invalidTime ( )
const std::string cond::invalidToken ( " "  )
Iov_t cond::makeIov ( cond::Time_t  since,
const Hash payloadId 
)

Definition at line 20 of file CondDBPyWrappers.cc.

References cond::Iov_t::payloadId, runTheMatrix::ret, writeEcalDQMStatus::since, and cond::Iov_t::since.

Referenced by BOOST_PYTHON_MODULE().

20  {
21  Iov_t ret;
22  ret.since = since;
23  ret.payloadId = payloadId;
24  return ret;
25  }
ret
prodAgent to be discontinued
void cond::parseLineForNamedParams ( const std::string &  line,
std::map< std::string, std::string > &  params 
)

Definition at line 57 of file DecodingKey.cc.

References B2GTnPMonitor_cfi::item, ItemSeparator, str, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by cond::auth::DecodingKey::createFromInputFile().

57  {
58  std::stringstream str(line);
59  std::string paramName("");
60  std::string paramValue("");
61  while (str.good()) {
62  std::string item("");
63  getline(str, item, ItemSeparator);
64  if (item.size() > 3) {
65  paramName = item.substr(0, 2);
66  paramValue = item.substr(2);
67  params.insert(std::make_pair(paramName, paramValue));
68  }
69  }
70  }
char ItemSeparator
Definition: DecodingKey.cc:14
#define str(s)
const char * cond::pluginCategory ( )

Definition at line 67 of file ProxyFactory.cc.

67 { return "CondProxyFactory"; }
char cond::randomChar ( )

Definition at line 36 of file DecodingKey.cc.

References b64str, and rand().

Referenced by cond::auth::KeyGenerator::make().

36  {
37  int irand = ::rand() % (::strlen(b64str));
38  return b64str[irand];
39  }
static const char * b64str
Definition: DecodingKey.cc:18
Signal rand(Signal arg)
Definition: vlib.cc:379
std::string cond::schemaLabel ( const std::string &  serviceName,
const std::string &  userName 
)
std::string cond::schemaLabelForCredentialStore ( const std::string &  connectionString)

Definition at line 162 of file CredentialStore.cc.

References writedatasetfile::parser, schemaLabel(), serviceName, and AlCaHLTBitMon_QueryRunRegistry::string.

162  {
163  coral::URIParser parser;
164  parser.setURI(connectionString);
165  std::string serviceName = parser.hostName();
166  std::string schemaName = parser.databaseOrSchemaName();
167  return schemaLabel(serviceName, schemaName);
168  }
static const std::string serviceName
std::string schemaLabel(const std::string &serviceName, const std::string &userName)
bool cond::selectAuthorization ( coral::ISchema &  schema,
int  principalId,
const std::string &  role,
const std::string &  connectionString,
AuthorizationData destination 
)

Definition at line 270 of file CredentialStore.cc.

References AUTH_ID_COL(), AUTH_KEY_COL(), C_ID_COL(), COND_AUTHORIZATION_TABLE(), cond::AuthorizationData::connectionId, newFWLiteAna::found, cond::AuthorizationData::id, cond::AuthorizationData::key, P_ID_COL(), contentValuesFiles::query, ROLE_COL(), SCHEMA_COL(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by setPermissionData().

274  {
275  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHORIZATION_TABLE).newQuery());
276  coral::AttributeList readBuff;
277  readBuff.extend<int>(AUTH_ID_COL);
278  readBuff.extend<int>(C_ID_COL);
279  readBuff.extend<std::string>(AUTH_KEY_COL);
280  coral::AttributeList whereData;
281  whereData.extend<int>(P_ID_COL);
282  whereData.extend<std::string>(ROLE_COL);
283  whereData.extend<std::string>(SCHEMA_COL);
284  whereData[P_ID_COL].data<int>() = principalId;
285  whereData[ROLE_COL].data<std::string>() = role;
286  whereData[SCHEMA_COL].data<std::string>() = connectionString;
287  std::stringstream whereClause;
288  whereClause << P_ID_COL << " = :" << P_ID_COL;
289  whereClause << " AND " << ROLE_COL << " = :" << ROLE_COL;
290  whereClause << " AND " << SCHEMA_COL << " = :" << SCHEMA_COL;
291  query->defineOutput(readBuff);
292  query->addToOutputList(AUTH_ID_COL);
293  query->addToOutputList(C_ID_COL);
294  query->addToOutputList(AUTH_KEY_COL);
295  query->setCondition(whereClause.str(), whereData);
296  coral::ICursor& cursor = query->execute();
297  bool found = false;
298  if (cursor.next()) {
299  const coral::AttributeList& row = cursor.currentRow();
300  destination.id = row[AUTH_ID_COL].data<int>();
301  destination.connectionId = row[C_ID_COL].data<int>();
302  destination.key = row[AUTH_KEY_COL].data<std::string>();
303  found = true;
304  }
305  return found;
306  }
static const std::string ROLE_COL("C_ROLE")
static const std::string SCHEMA_COL("C_SCHEMA")
static const std::string COND_AUTHORIZATION_TABLE("COND_AUTHORIZATION")
Definition: query.py:1
static const std::string AUTH_ID_COL("AUTH_ID")
static const std::string P_ID_COL("P_ID")
static const std::string C_ID_COL("C_ID")
static const std::string AUTH_KEY_COL("CRED3")
bool cond::selectConnection ( coral::ISchema &  schema,
const std::string &  connectionLabel,
CredentialData destination 
)

Definition at line 230 of file CredentialStore.cc.

References COND_CREDENTIAL_TABLE(), CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), cond::CredentialData::connectionKey, newFWLiteAna::found, cond::CredentialData::id, cond::CredentialData::password, PASSWORD_COL(), contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, cond::CredentialData::userName, USERNAME_COL(), VERIFICATION_KEY_COL(), and cond::CredentialData::verificationKey.

Referenced by cond::CredentialStore::removeConnection(), cond::CredentialStore::setPermission(), updateConnectionData(), and cond::CredentialStore::updatePrincipal().

230  {
231  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_CREDENTIAL_TABLE).newQuery());
232  coral::AttributeList readBuff;
233  readBuff.extend<int>(CONNECTION_ID_COL);
234  readBuff.extend<std::string>(USERNAME_COL);
235  readBuff.extend<std::string>(PASSWORD_COL);
236  readBuff.extend<std::string>(VERIFICATION_KEY_COL);
237  readBuff.extend<std::string>(CONNECTION_KEY_COL);
238  coral::AttributeList whereData;
239  whereData.extend<std::string>(CONNECTION_LABEL_COL);
240  whereData[CONNECTION_LABEL_COL].data<std::string>() = connectionLabel;
241  std::string whereClause = CONNECTION_LABEL_COL + " = :" + CONNECTION_LABEL_COL;
242  query->defineOutput(readBuff);
243  query->addToOutputList(CONNECTION_ID_COL);
244  query->addToOutputList(USERNAME_COL);
245  query->addToOutputList(PASSWORD_COL);
246  query->addToOutputList(VERIFICATION_KEY_COL);
247  query->addToOutputList(CONNECTION_KEY_COL);
248  query->setCondition(whereClause, whereData);
249  coral::ICursor& cursor = query->execute();
250  bool found = false;
251  if (cursor.next()) {
252  const coral::AttributeList& row = cursor.currentRow();
253  destination.id = row[CONNECTION_ID_COL].data<int>();
254  destination.userName = row[USERNAME_COL].data<std::string>();
255  destination.password = row[PASSWORD_COL].data<std::string>();
256  destination.verificationKey = row[VERIFICATION_KEY_COL].data<std::string>();
257  destination.connectionKey = row[CONNECTION_KEY_COL].data<std::string>();
258  found = true;
259  }
260  return found;
261  }
static const std::string PASSWORD_COL("CRED5")
static const std::string COND_CREDENTIAL_TABLE("COND_CREDENTIAL")
static const std::string CONNECTION_KEY_COL("CRED7")
Definition: query.py:1
static const std::string VERIFICATION_KEY_COL("CRED6")
static const std::string USERNAME_COL("CRED4")
static const std::string CONNECTION_ID_COL("CONN_ID")
static const std::string CONNECTION_LABEL_COL("CONN_LABEL")
bool cond::selectPrincipal ( coral::ISchema &  schema,
const std::string &  principal,
PrincipalData destination 
)

Definition at line 191 of file CredentialStore.cc.

References ADMIN_KEY_COL(), cond::PrincipalData::adminKey, COND_AUTHENTICATION_TABLE(), newFWLiteAna::found, cond::PrincipalData::id, PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), cond::PrincipalData::principalKey, contentValuesFiles::query, AlCaHLTBitMon_QueryRunRegistry::string, VERIFICATION_COL(), and cond::PrincipalData::verifKey.

Referenced by cond::CredentialStore::importForPrincipal(), cond::CredentialStore::removePrincipal(), cond::CredentialStore::resetAdmin(), cond::CredentialStore::setPermission(), cond::CredentialStore::startSession(), cond::CredentialStore::unsetPermission(), and updatePrincipalData().

191  {
192  std::unique_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHENTICATION_TABLE).newQuery());
193  coral::AttributeList readBuff;
194  readBuff.extend<int>(PRINCIPAL_ID_COL);
195  readBuff.extend<std::string>(VERIFICATION_COL);
196  readBuff.extend<std::string>(PRINCIPAL_KEY_COL);
197  readBuff.extend<std::string>(ADMIN_KEY_COL);
198  coral::AttributeList whereData;
199  whereData.extend<std::string>(PRINCIPAL_NAME_COL);
200  whereData[PRINCIPAL_NAME_COL].data<std::string>() = principal;
201  std::string whereClause = PRINCIPAL_NAME_COL + " = :" + PRINCIPAL_NAME_COL;
202  query->defineOutput(readBuff);
203  query->addToOutputList(PRINCIPAL_ID_COL);
204  query->addToOutputList(VERIFICATION_COL);
205  query->addToOutputList(PRINCIPAL_KEY_COL);
206  query->addToOutputList(ADMIN_KEY_COL);
207  query->setCondition(whereClause, whereData);
208  coral::ICursor& cursor = query->execute();
209  bool found = false;
210  if (cursor.next()) {
211  found = true;
212  const coral::AttributeList& row = cursor.currentRow();
213  destination.id = row[PRINCIPAL_ID_COL].data<int>();
214  destination.verifKey = row[VERIFICATION_COL].data<std::string>();
215  destination.principalKey = row[PRINCIPAL_KEY_COL].data<std::string>();
216  destination.adminKey = row[ADMIN_KEY_COL].data<std::string>();
217  }
218  return found;
219  }
static const std::string COND_AUTHENTICATION_TABLE("COND_AUTHENTICATION")
Definition: query.py:1
static const std::string ADMIN_KEY_COL("CRED2")
static const std::string VERIFICATION_COL("CRED0")
static const std::string PRINCIPAL_ID_COL("P_ID")
static const std::string PRINCIPAL_KEY_COL("CRED1")
static const std::string PRINCIPAL_NAME_COL("P_NAME")
template<typename T >
std::pair<Binary, Binary> cond::serialize ( const T payload)

Definition at line 66 of file Serialization.h.

References MillePedeFileConverter_cfg::e, cppFunctionSkipper::exception, cond::StreamerInfo::jsonString(), jets_cff::payload, runTheMatrix::ret, AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

Referenced by cond::persistency::Session::storePayload< std::string >(), cond::persistency::Session::storePayload(), and RawEventFileWriterForBU::writeJsds().

66  {
67  std::pair<Binary, Binary> ret;
68  std::string streamerInfo(StreamerInfo::jsonString());
69  try {
70  // save data to buffers
71  std::ostringstream dataBuffer;
72  CondOutputArchive oa(dataBuffer);
73  oa << payload;
74  //TODO: avoid (2!!) copies
75  ret.first.copy(dataBuffer.str());
76  ret.second.copy(streamerInfo);
77  } catch (const std::exception& e) {
78  std::string em(e.what());
79  throwException("Serialization failed: " + em + ". Serialization info:" + streamerInfo, "serialize");
80  }
81  return ret;
82  }
ret
prodAgent to be discontinued
cond::serialization::OutputArchive CondOutputArchive
Definition: Serialization.h:62
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
bool cond::setPermissionData ( coral::ISchema &  schema,
int  principalId,
const std::string &  principalKey,
const std::string &  role,
const std::string &  connectionString,
int  connectionId,
const std::string &  connectionKey 
)

Definition at line 399 of file CredentialStore.cc.

References AUTH_ID_COL(), AUTH_KEY_COL(), cond::auth::Cipher::b64encrypt(), C_ID_COL(), COND_AUTHORIZATION_TABLE(), newFWLiteAna::found, getNextSequenceValue(), cond::AuthorizationData::id, GetRecoTauVFromDQM_MC_cff::next, P_ID_COL(), ROLE_COL(), SCHEMA_COL(), selectAuthorization(), AlCaHLTBitMon_QueryRunRegistry::string, and cond::persistency::throwException().

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::importForPrincipal(), cond::CredentialStore::resetAdmin(), cond::CredentialStore::setPermission(), and cond::CredentialStore::updatePrincipal().

405  {
406  auth::Cipher cipher(principalKey);
407  std::string encryptedConnectionKey = cipher.b64encrypt(connectionKey);
408  AuthorizationData authData;
409  bool found = selectAuthorization(schema, principalId, role, connectionString, authData);
410 
411  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHORIZATION_TABLE).dataEditor();
412  if (found) {
413  coral::AttributeList updateData;
414  updateData.extend<int>(AUTH_ID_COL);
415  updateData.extend<int>(C_ID_COL);
416  updateData.extend<std::string>(AUTH_KEY_COL);
417  updateData[AUTH_ID_COL].data<int>() = authData.id;
418  updateData[C_ID_COL].data<int>() = connectionId;
419  updateData[AUTH_KEY_COL].data<std::string>() = encryptedConnectionKey;
420  std::string setCl = C_ID_COL + " = :" + C_ID_COL + ", " + AUTH_KEY_COL + " = :" + AUTH_KEY_COL;
421  std::string whereCl = AUTH_ID_COL + " = :" + AUTH_ID_COL;
422  editor.updateRows(setCl, whereCl, updateData);
423  } else {
424  int next = -1;
426  throwException("Can't find " + COND_AUTHORIZATION_TABLE + " sequence.", "CredentialStore::setPermission");
427 
428  coral::AttributeList insertData;
429  insertData.extend<int>(AUTH_ID_COL);
430  insertData.extend<int>(P_ID_COL);
431  insertData.extend<std::string>(ROLE_COL);
432  insertData.extend<std::string>(SCHEMA_COL);
433  insertData.extend<std::string>(AUTH_KEY_COL);
434  insertData.extend<int>(C_ID_COL);
435  insertData[AUTH_ID_COL].data<int>() = next;
436  insertData[P_ID_COL].data<int>() = principalId;
437  insertData[ROLE_COL].data<std::string>() = role;
438  insertData[SCHEMA_COL].data<std::string>() = connectionString;
439  insertData[AUTH_KEY_COL].data<std::string>() = encryptedConnectionKey;
440  insertData[C_ID_COL].data<int>() = connectionId;
441  editor.insertRow(insertData);
442  }
443  return true;
444  }
static const std::string ROLE_COL("C_ROLE")
static const std::string SCHEMA_COL("C_SCHEMA")
bool getNextSequenceValue(coral::ISchema &schema, const std::string &sequenceName, int &value)
static const std::string COND_AUTHORIZATION_TABLE("COND_AUTHORIZATION")
bool selectAuthorization(coral::ISchema &schema, int principalId, const std::string &role, const std::string &connectionString, AuthorizationData &destination)
static const std::string AUTH_ID_COL("AUTH_ID")
static const std::string P_ID_COL("P_ID")
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
static const std::string C_ID_COL("C_ID")
static const std::string AUTH_KEY_COL("CRED3")
SynchronizationType cond::synchronizationTypeFromName ( const std::string &  name)

Definition at line 46 of file Types.cc.

References mps_fire::i, and throwException().

Referenced by cond::persistency::GetFromRow< cond::SynchronizationType >::operator()().

46  {
47  for (auto const &i : s_synchronizationTypeArray)
48  if (name == i.first)
49  return i.second;
50  for (auto const &i : s_obsoleteSynchronizationTypeArray)
51  if (name == i.first)
52  return i.second;
53  throwException("SynchronizationType \"" + name + "\" is unknown.", "synchronizationTypeFromName");
54  }
static std::pair< const char *, SynchronizationType > s_synchronizationTypeArray[]
Definition: Types.cc:28
static std::pair< const char *, SynchronizationType > s_obsoleteSynchronizationTypeArray[]
Definition: Types.cc:39
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
std::string cond::synchronizationTypeNames ( SynchronizationType  type)

Definition at line 44 of file Types.cc.

Referenced by cond::persistency::f_add_attribute(), and cond::persistency::IOVEditor::flush().

44 { return s_synchronizationTypeArray[type].first; }
type
Definition: HCALResponse.h:21
static std::pair< const char *, SynchronizationType > s_synchronizationTypeArray[]
Definition: Types.cc:28
void cond::throwException ( const std::string &  message,
const std::string &  methodName 
)

Definition at line 18 of file Exception.cc.

References cond::persistency::Exception::Exception().

Referenced by cond::service::PoolDBOutputService::appendSinceTime(), cond::auth::Cipher::b64decrypt(), cond::service::PoolDBOutputService::closeIOV(), cond::auth::DecodingKey::createFromInputFile(), cond::service::PoolDBOutputService::createNewIOV(), createPayload(), createPayload< HcalCalibrationQIEData >(), createPayload< std::string >(), cond::CredentialStore::createSchema(), cond::RelationalAuthenticationService::RelationalAuthenticationService::credentials(), cond::Binary::data(), default_deserialize(), deserialize< BaseKeyed >(), deserialize< condex::Efficiency >(), deserialize< CSCReadoutMapping >(), deserialize< CSCReadoutMappingForSliceTest >(), deserialize< PerformancePayload >(), cond::auth::DecodingKey::flush(), cond::persistency::getConnectionParams(), getLoginName(), cond::CredentialStore::importForPrincipal(), cond::persistency::importPayload(), cond::auth::DecodingKey::init(), cond::service::PoolDBOutputService::initDB(), cond::persistency::IOVEditor::load(), cond::persistency::KeyList::loadFromDB(), cond::service::PoolDBOutputService::lookUpRecord(), cond::CredentialStore::removeConnection(), cond::CredentialStore::removePrincipal(), cond::CredentialStore::resetAdmin(), serialize(), cond::persistency::KeyList::setKeys(), cond::CredentialStore::setPermission(), cond::CredentialStore::setUpForService(), cond::Binary::size(), synchronizationTypeFromName(), cond::CredentialStore::unsetPermission(), and cond::CredentialStore::updatePrincipal().

18  {
19  throw Exception(message, methodName);
20  }
const Time_t cond::TIMELIMIT ( std::numeric_limits< Time_t ::max())
std::string const & cond::timeTypeNames ( int  i)

Definition at line 11 of file Time.cc.

References mps_fire::i, DTRecHitClients_cfi::local, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by CondDBESSource::setIntervalFor(), and cond::TimeTypeTraits< type >::specs().

11  {
12  static const std::string local[] = {"runnumber", "timestamp", "lumiid", "hash", "userid"};
13  return local[i];
14  }
std::pair<int, std::string> cond::updateConnectionData ( coral::ISchema &  schema,
const std::string &  adminKey,
const std::string &  connectionLabel,
const std::string &  userName,
const std::string &  password,
bool  forceUpdate 
)

Definition at line 446 of file CredentialStore.cc.

References cond::auth::Cipher::b64decrypt(), cond::auth::Cipher::b64encrypt(), COND_CREDENTIAL_TABLE(), cond::auth::COND_DB_KEY_SIZE, CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), cond::CredentialData::connectionKey, newFWLiteAna::found, relval_steps::gen(), getNextSequenceValue(), cond::CredentialData::id, cond::auth::KeyGenerator::make(), PASSWORD_COL(), selectConnection(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), USERNAME_COL(), VERIFICATION_KEY_COL(), and cond::CredentialData::verificationKey.

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::importForPrincipal(), cond::CredentialStore::resetAdmin(), and cond::CredentialStore::updateConnection().

451  {
452  CredentialData credsData;
453  bool found = selectConnection(schema, connectionLabel, credsData);
454  int connId = credsData.id;
455 
456  auth::Cipher adminCipher(adminKey);
457  std::string connectionKey("");
458  coral::ITableDataEditor& editor = schema.tableHandle(COND_CREDENTIAL_TABLE).dataEditor();
459  if (found) {
460  connectionKey = adminCipher.b64decrypt(credsData.connectionKey);
461  auth::Cipher cipher(connectionKey);
462  std::string verificationKey = cipher.b64decrypt(credsData.verificationKey);
463  if (verificationKey != connectionLabel) {
464  throwException("Decoding of connection key failed.", "CredentialStore::updateConnection");
465  }
466  if (forceUpdate) {
467  std::string encryptedUserName = cipher.b64encrypt(userName);
468  std::string encryptedPassword = cipher.b64encrypt(password);
469 
470  coral::AttributeList updateData;
471  updateData.extend<int>(CONNECTION_ID_COL);
472  updateData.extend<std::string>(USERNAME_COL);
473  updateData.extend<std::string>(PASSWORD_COL);
474  updateData[CONNECTION_ID_COL].data<int>() = connId;
475  updateData[USERNAME_COL].data<std::string>() = encryptedUserName;
476  updateData[PASSWORD_COL].data<std::string>() = encryptedPassword;
477  std::stringstream setCl;
478  setCl << USERNAME_COL << " = :" << USERNAME_COL;
479  setCl << ", " << PASSWORD_COL << " = :" << PASSWORD_COL;
480  std::string whereCl = CONNECTION_ID_COL + " = :" + CONNECTION_ID_COL;
481  editor.updateRows(setCl.str(), whereCl, updateData);
482  }
483  }
484 
485  if (!found) {
486  auth::KeyGenerator gen;
487  connectionKey = gen.make(auth::COND_DB_KEY_SIZE);
488  auth::Cipher cipher(connectionKey);
489  std::string encryptedUserName = cipher.b64encrypt(userName);
490  std::string encryptedPassword = cipher.b64encrypt(password);
491  std::string encryptedLabel = cipher.b64encrypt(connectionLabel);
492 
493  if (!getNextSequenceValue(schema, COND_CREDENTIAL_TABLE, connId))
494  throwException("Can't find " + COND_CREDENTIAL_TABLE + " sequence.", "CredentialStore::updateConnection");
495 
496  coral::AttributeList insertData;
497  insertData.extend<int>(CONNECTION_ID_COL);
498  insertData.extend<std::string>(CONNECTION_LABEL_COL);
499  insertData.extend<std::string>(USERNAME_COL);
500  insertData.extend<std::string>(PASSWORD_COL);
501  insertData.extend<std::string>(VERIFICATION_KEY_COL);
502  insertData.extend<std::string>(CONNECTION_KEY_COL);
503  insertData[CONNECTION_ID_COL].data<int>() = connId;
504  insertData[CONNECTION_LABEL_COL].data<std::string>() = connectionLabel;
505  insertData[USERNAME_COL].data<std::string>() = encryptedUserName;
506  insertData[PASSWORD_COL].data<std::string>() = encryptedPassword;
507  insertData[VERIFICATION_KEY_COL].data<std::string>() = encryptedLabel;
508  insertData[CONNECTION_KEY_COL].data<std::string>() = adminCipher.b64encrypt(connectionKey);
509  ;
510  editor.insertRow(insertData);
511  }
512  return std::make_pair(connId, connectionKey);
513  }
bool getNextSequenceValue(coral::ISchema &schema, const std::string &sequenceName, int &value)
static const std::string PASSWORD_COL("CRED5")
static const std::string COND_CREDENTIAL_TABLE("COND_CREDENTIAL")
static const std::string CONNECTION_KEY_COL("CRED7")
static const std::string VERIFICATION_KEY_COL("CRED6")
static constexpr unsigned int COND_DB_KEY_SIZE
Definition: Auth.h:25
bool selectConnection(coral::ISchema &schema, const std::string &connectionLabel, CredentialData &destination)
static const std::string USERNAME_COL("CRED4")
def gen(fragment, howMuch)
Production test section ####.
static const std::string CONNECTION_ID_COL("CONN_ID")
static const std::string CONNECTION_LABEL_COL("CONN_LABEL")
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
std::pair<int, std::string> cond::updatePrincipalData ( coral::ISchema &  schema,
const std::string &  authenticationKey,
const std::string &  principalName,
const std::string &  adminKey,
bool  init = false 
)

Definition at line 341 of file CredentialStore.cc.

References ADMIN_KEY_COL(), cond::PrincipalData::adminKey, cond::auth::Cipher::b64decrypt(), cond::auth::Cipher::b64encrypt(), COND_AUTHENTICATION_TABLE(), cond::auth::COND_DB_KEY_SIZE, newFWLiteAna::found, relval_steps::gen(), getNextSequenceValue(), cond::PrincipalData::id, cond::auth::KeyGenerator::make(), PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), selectPrincipal(), AlCaHLTBitMon_QueryRunRegistry::string, cond::persistency::throwException(), and VERIFICATION_COL().

Referenced by cond::CredentialStore::createSchema(), cond::CredentialStore::resetAdmin(), and cond::CredentialStore::updatePrincipal().

345  {
346  PrincipalData princData;
347  bool found = selectPrincipal(schema, principalName, princData);
348 
349  auth::Cipher cipher0(authenticationKey);
350  auth::Cipher cipher1(adminKey);
351 
352  std::string verifStr = cipher0.b64encrypt(principalName);
353  std::string principalKey("");
354  int principalId = princData.id;
355 
356  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
357  if (found) {
358  principalKey = cipher1.b64decrypt(princData.adminKey);
359  coral::AttributeList updateData;
360  updateData.extend<int>(PRINCIPAL_ID_COL);
361  updateData.extend<std::string>(VERIFICATION_COL);
362  updateData.extend<std::string>(PRINCIPAL_KEY_COL);
363  updateData.extend<std::string>(ADMIN_KEY_COL);
364  updateData[PRINCIPAL_ID_COL].data<int>() = principalId;
365  updateData[VERIFICATION_COL].data<std::string>() = verifStr;
366  updateData[PRINCIPAL_KEY_COL].data<std::string>() = cipher0.b64encrypt(principalKey);
367  updateData[ADMIN_KEY_COL].data<std::string>() = cipher1.b64encrypt(principalKey);
368  std::stringstream setClause;
369  setClause << VERIFICATION_COL << " = :" << VERIFICATION_COL << ", ";
370  setClause << PRINCIPAL_KEY_COL << " = :" << PRINCIPAL_KEY_COL << ", ";
371  setClause << ADMIN_KEY_COL << " = :" << ADMIN_KEY_COL;
372  std::string whereClause = PRINCIPAL_ID_COL + " = :" + PRINCIPAL_ID_COL;
373  editor.updateRows(setClause.str(), whereClause, updateData);
374  } else {
375  if (init) {
376  principalKey = adminKey;
377  } else {
378  auth::KeyGenerator gen;
379  principalKey = gen.make(auth::COND_DB_KEY_SIZE);
380  }
381  coral::ITableDataEditor& editor0 = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
382 
383  if (!getNextSequenceValue(schema, COND_AUTHENTICATION_TABLE, principalId))
384  throwException("Can't find " + COND_AUTHENTICATION_TABLE + " sequence.", "CredentialStore::updatePrincipal");
385 
386  coral::AttributeList authData;
387  editor0.rowBuffer(authData);
388  authData[PRINCIPAL_ID_COL].data<int>() = principalId;
389  authData[PRINCIPAL_NAME_COL].data<std::string>() = principalName;
390  authData[VERIFICATION_COL].data<std::string>() = verifStr;
391  authData[PRINCIPAL_KEY_COL].data<std::string>() = cipher0.b64encrypt(principalKey);
392  authData[ADMIN_KEY_COL].data<std::string>() = cipher1.b64encrypt(principalKey);
393  editor0.insertRow(authData);
394  }
395 
396  return std::make_pair(principalId, principalKey);
397  }
bool getNextSequenceValue(coral::ISchema &schema, const std::string &sequenceName, int &value)
static const std::string COND_AUTHENTICATION_TABLE("COND_AUTHENTICATION")
static const std::string ADMIN_KEY_COL("CRED2")
static constexpr unsigned int COND_DB_KEY_SIZE
Definition: Auth.h:25
static const std::string VERIFICATION_COL("CRED0")
def gen(fragment, howMuch)
Production test section ####.
bool selectPrincipal(coral::ISchema &schema, const std::string &principal, PrincipalData &destination)
Definition: init.py:1
static const std::string PRINCIPAL_ID_COL("P_ID")
static const std::string PRINCIPAL_KEY_COL("CRED1")
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:12
static const std::string PRINCIPAL_NAME_COL("P_NAME")

Variable Documentation

constexpr unsigned int cond::HASH_SIZE = 40
static

Definition at line 44 of file Types.h.

std::pair<const char *, SynchronizationType> cond::s_obsoleteSynchronizationTypeArray[]
static
Initial value:
= {
std::make_pair("Offline", SYNCH_OFFLINE),
std::make_pair("HLT", SYNCH_HLT),
std::make_pair("Prompt", SYNCH_PROMPT),
std::make_pair("Pcl", SYNCH_PCL)}

Definition at line 39 of file Types.cc.

std::pair<const char *, SynchronizationType> cond::s_synchronizationTypeArray[]
static
Initial value:
= {
std::make_pair("any", SYNCH_ANY),
std::make_pair("validation", SYNCH_VALIDATION),
std::make_pair("offline", SYNCH_OFFLINE),
std::make_pair("mc", SYNCH_MC),
std::make_pair("runmc", SYNCH_RUNMC),
std::make_pair("hlt", SYNCH_HLT),
std::make_pair("express", SYNCH_EXPRESS),
std::make_pair("prompt", SYNCH_PROMPT),
std::make_pair("pcl", SYNCH_PCL)}

Definition at line 28 of file Types.cc.

const unsigned int cond::TIMETYPE_LIST_MAX = 5

Definition at line 20 of file Time.h.

Referenced by findSpecs().

const cond::TimeType cond::timeTypeList = {runnumber, timestamp, lumiid, hash, userid}

Definition at line 7 of file Time.cc.

const TimeTypeSpecs cond::timeTypeSpecs
const cond::TimeType cond::timeTypeValues = {runnumber, timestamp, lumiid, hash, userid}

Definition at line 9 of file Time.cc.