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  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< coral::Service *(const std::string &) > 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::shared_ptr< Tdefault_deserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<typename T >
std::shared_ptr< Tdeserialize (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::shared_ptr< BaseKeyeddeserialize< BaseKeyed > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::shared_ptr< condex::Efficiencydeserialize< condex::Efficiency > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::shared_ptr< CSCReadoutMappingdeserialize< CSCReadoutMapping > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::shared_ptr< CSCReadoutMappingForSliceTestdeserialize< CSCReadoutMappingForSliceTest > (const std::string &payloadType, const Binary &payloadData, const Binary &streamerInfoData)
 
template<>
std::shared_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]
 
const TimeTypeSpecs timeTypeSpecs []
 
const cond::TimeType timeTypeValues []
 

Detailed Description

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

Typedef Documentation

Definition at line 58 of file Serialization.h.

Definition at line 59 of file Serialization.h.

typedef edmplugin::PluginFactory< coral::Service*(const std::string&) > cond::CoralServicePluginFactory

Definition at line 24 of file CoralServiceFactory.h.

Definition at line 25 of file Exception.h.

typedef std::string cond::Hash

Definition at line 45 of file Types.h.

Definition at line 29 of file ProxyFactory.h.

Definition at line 81 of file Types.h.

typedef unsigned long long cond::Time_t

Definition at line 16 of file Time.h.

typedef unsigned long long cond::uint64_t

Definition at line 15 of file Time.h.

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

Definition at line 17 of file Time.h.

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

Definition at line 19 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 29 of file Types.h.

Enumerator
invalid 
runnumber 
timestamp 
lumiid 
hash 
userid 

Definition at line 21 of file Time.h.

cond::TimeType TimeType
Definition: Time.h:29

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 30 of file Serialization.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

30  {
31  std::string userTypeName = demangledName( typeid(T) );
32  if( userTypeName != payloadTypeName )
33  throwException(std::string("Type mismatch, user type: \""+userTypeName+"\", target type: \"")+payloadTypeName+"\"",
34  "createPayload" );
35  return new T;
36  }
long double T
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
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" ) return new HcalCalibrationQIEData(nullptr);
39  throwException(std::string("Type mismatch, target object is type \"")+payloadTypeName+"\"",
40  "createPayload" );
41  }
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
template<>
std::string* cond::createPayload< std::string > ( const std::string &  payloadTypeName)
inline

Definition at line 38 of file Serialization.h.

References AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

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

Definition at line 81 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().

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

Definition at line 113 of file Serialization.h.

References SiPixelClusterizer_cfi::payloadType.

115  {
116  return default_deserialize<T>( payloadType, payloadData, streamerInfoData );
117  }
template<>
std::shared_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_BASE_CASE(BASETYPENAME)
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
template<>
std::shared_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:14
template<>
std::shared_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:14
template<>
std::shared_ptr<CSCReadoutMappingForSliceTest> cond::deserialize< CSCReadoutMappingForSliceTest > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 73 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:14
template<>
std::shared_ptr<PerformancePayload> cond::deserialize< PerformancePayload > ( const std::string &  payloadType,
const Binary payloadData,
const Binary streamerInfoData 
)

Definition at line 17 of file PerformanceRecordPlugin.cc.

References DESERIALIZE_POLIMORPHIC_CASE, MillePedeFileConverter_cfg::e, PerformancePayload::initialize(), AlCaHLTBitMon_QueryRunRegistry::string, and throwException().

19  {
20  // DESERIALIZE_BASE_CASE( PerformancePayload ); abstract
24  // here we come if none of the deserializations above match the payload type:
25  throwException(std::string("Type mismatch, target object is type \"")+payloadType+"\"",
26  "createPayload" );
27  }
#define DESERIALIZE_POLIMORPHIC_CASE(BASETYPENAME, DERIVEDTYPENAME)
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
const TimeTypeSpecs & cond::findSpecs ( std::string const &  name)

Definition at line 33 of file Time.cc.

References Exception, mps_fire::i, and TIMETYPE_LIST_MAX.

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

33  {
34  size_t i=0;
35  for (; i<TIMETYPE_LIST_MAX; i++)
36  if (name==timeTypeSpecs[i].name) return timeTypeSpecs[i];
37  throw cms::Exception("invalid timetype: "+name);
38  return timeTypeSpecs[0]; // compiler happy
39  }
const TimeTypeSpecs timeTypeSpecs[]
Definition: Time.cc:22
const unsigned int TIMETYPE_LIST_MAX
Definition: Time.h:22
int cond::getch ( )

Definition at line 23 of file Utilities.cc.

Referenced by getpass().

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

Definition at line 42 of file DecodingKey.cc.

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

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

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

Definition at line 335 of file CredentialStore.cc.

References das::query(), SEQUENCE_NAME_COL(), SEQUENCE_TABLE_NAME(), SEQUENCE_VALUE_COL(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

337  {
338  bool ret = false;
339  std::auto_ptr< coral::IQuery > query( schema.tableHandle( SEQUENCE_TABLE_NAME ).newQuery() );
340  query->limitReturnedRows( 1, 0 );
341  query->addToOutputList( SEQUENCE_VALUE_COL );
342  query->defineOutputType( SEQUENCE_VALUE_COL, coral::AttributeSpecification::typeNameForType<int>() );
343  query->setForUpdate();
344  std::string whereClause( SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL );
345  coral::AttributeList rowData;
346  rowData.extend<std::string>( SEQUENCE_NAME_COL );
347  rowData.begin()->data< std::string >() = sequenceName;
348  query->setCondition( whereClause, rowData );
349  coral::ICursor& cursor = query->execute();
350  if ( cursor.next() ) {
351  value = cursor.currentRow().begin()->data<int>()+1;
352  ret = true;
353  } else {
354  return false;
355  }
356  // update...
357  coral::AttributeList updateData;
358  updateData.extend<std::string>( SEQUENCE_NAME_COL );
359  updateData.extend<int>( SEQUENCE_VALUE_COL );
360  std::string setClause( SEQUENCE_VALUE_COL + " = :" + SEQUENCE_VALUE_COL );
361  std::string whClause( SEQUENCE_NAME_COL + " = :" + SEQUENCE_NAME_COL );
362  coral::AttributeList::iterator iAttribute = updateData.begin();
363  iAttribute->data< std::string >() = sequenceName;
364  ++iAttribute;
365  iAttribute->data< int >() = value;
366  schema.tableHandle( SEQUENCE_TABLE_NAME ).dataEditor().updateRows( setClause,whClause,updateData );
367  return ret;
368  }
static const std::string SEQUENCE_VALUE_COL("VALUE")
static const std::string SEQUENCE_TABLE_NAME("COND_CREDENTIAL_SEQUENCE")
def query(query_str, verbose=False)
Definition: das.py:5
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 38 of file Utilities.cc.

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

Referenced by getpassForUser().

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

Definition at line 62 of file Utilities.cc.

References getpass(), and AlCaHLTBitMon_QueryRunRegistry::string.

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

Definition at line 45 of file hash64.cc.

References a, b, EnergyCorrector::c, hcalDigis_cfi::level, and mix64.

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

49  {
50  ub8 a,b,c,len;
51 
52  /* Set up the internal state */
53  len = length;
54  a = b = level; /* the previous hash value */
55  c = 0x9e3779b97f4a7c13LL; /* the golden ratio; an arbitrary value */
56 
57  /*---------------------------------------- handle most of the key */
58  if (((unsigned long)k)&7)
59  {
60  while (len >= 24)
61  {
62  a += (k[0] +((ub8)k[ 1]<< 8)+((ub8)k[ 2]<<16)+((ub8)k[ 3]<<24)
63  +((ub8)k[4 ]<<32)+((ub8)k[ 5]<<40)+((ub8)k[ 6]<<48)+((ub8)k[ 7]<<56));
64  b += (k[8] +((ub8)k[ 9]<< 8)+((ub8)k[10]<<16)+((ub8)k[11]<<24)
65  +((ub8)k[12]<<32)+((ub8)k[13]<<40)+((ub8)k[14]<<48)+((ub8)k[15]<<56));
66  c += (k[16] +((ub8)k[17]<< 8)+((ub8)k[18]<<16)+((ub8)k[19]<<24)
67  +((ub8)k[20]<<32)+((ub8)k[21]<<40)+((ub8)k[22]<<48)+((ub8)k[23]<<56));
68  mix64(a,b,c);
69  k += 24; len -= 24;
70  }
71  }
72  else
73  {
74  while (len >= 24) /* aligned */
75  {
76  a += *(ub8 *)(k+0);
77  b += *(ub8 *)(k+8);
78  c += *(ub8 *)(k+16);
79  mix64(a,b,c);
80  k += 24; len -= 24;
81  }
82  }
83 
84  /*------------------------------------- handle the last 23 bytes */
85  c += length;
86  switch(len) /* all the case statements fall through */
87  {
88  case 23: c+=((ub8)k[22]<<56);
89  case 22: c+=((ub8)k[21]<<48);
90  case 21: c+=((ub8)k[20]<<40);
91  case 20: c+=((ub8)k[19]<<32);
92  case 19: c+=((ub8)k[18]<<24);
93  case 18: c+=((ub8)k[17]<<16);
94  case 17: c+=((ub8)k[16]<<8);
95  /* the first byte of c is reserved for the length */
96  case 16: b+=((ub8)k[15]<<56);
97  case 15: b+=((ub8)k[14]<<48);
98  case 14: b+=((ub8)k[13]<<40);
99  case 13: b+=((ub8)k[12]<<32);
100  case 12: b+=((ub8)k[11]<<24);
101  case 11: b+=((ub8)k[10]<<16);
102  case 10: b+=((ub8)k[ 9]<<8);
103  case 9: b+=((ub8)k[ 8]);
104  case 8: a+=((ub8)k[ 7]<<56);
105  case 7: a+=((ub8)k[ 6]<<48);
106  case 6: a+=((ub8)k[ 5]<<40);
107  case 5: a+=((ub8)k[ 4]<<32);
108  case 4: a+=((ub8)k[ 3]<<24);
109  case 3: a+=((ub8)k[ 2]<<16);
110  case 2: a+=((ub8)k[ 1]<<8);
111  case 1: a+=((ub8)k[ 0]);
112  /* case 0: nothing left to add */
113  }
114  mix64(a,b,c);
115  /*-------------------------------------------- report the result */
116  return c;
117  }
#define mix64(a, b, c)
Definition: hash64.cc:22
unsigned long long ub8
Definition: hash64.cc:38
int k[5][pyjets_maxn]
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
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, cond::Iov_t::since, and ntuplemaker::since.

Referenced by BOOST_PYTHON_MODULE().

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

Definition at line 58 of file DecodingKey.cc.

References ItemSeparator, str, and AlCaHLTBitMon_QueryRunRegistry::string.

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

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

Definition at line 33 of file ProxyFactory.cc.

34  {
35  return "CondProxyFactory";
36  }
char cond::randomChar ( )

Definition at line 37 of file DecodingKey.cc.

References b64str, and rand().

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

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

Definition at line 153 of file CredentialStore.cc.

References serviceName, and AlCaHLTBitMon_QueryRunRegistry::string.

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

154  {
155  std::string ret = userName;
156  if( !serviceName.empty() ){
157  ret += "@"+serviceName;
158  }
159  return ret;
160  }
static const std::string serviceName
std::string cond::schemaLabelForCredentialStore ( const std::string &  connectionString)

Definition at line 162 of file CredentialStore.cc.

References createfilelist::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 297 of file CredentialStore.cc.

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

Referenced by setPermissionData().

301  {
302  std::auto_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHORIZATION_TABLE).newQuery());
303  coral::AttributeList readBuff;
304  readBuff.extend<int>(AUTH_ID_COL);
305  readBuff.extend<int>(C_ID_COL);
306  readBuff.extend<std::string>(AUTH_KEY_COL);
307  coral::AttributeList whereData;
308  whereData.extend<int>(P_ID_COL);
309  whereData.extend<std::string>(ROLE_COL);
310  whereData.extend<std::string>(SCHEMA_COL);
311  whereData[ P_ID_COL ].data<int>() = principalId;
312  whereData[ ROLE_COL ].data<std::string>() = role;
313  whereData[ SCHEMA_COL ].data<std::string>() = connectionString;
314  std::stringstream whereClause;
315  whereClause << P_ID_COL << " = :"<<P_ID_COL;
316  whereClause << " AND " << ROLE_COL << " = :"<<ROLE_COL;
317  whereClause << " AND " << SCHEMA_COL << " = :"<<SCHEMA_COL;
318  query->defineOutput(readBuff);
319  query->addToOutputList( AUTH_ID_COL );
320  query->addToOutputList( C_ID_COL );
321  query->addToOutputList( AUTH_KEY_COL );
322  query->setCondition( whereClause.str(), whereData );
323  coral::ICursor& cursor = query->execute();
324  bool found = false;
325  if ( cursor.next() ) {
326  const coral::AttributeList& row = cursor.currentRow();
327  destination.id = row[AUTH_ID_COL].data<int>();
328  destination.connectionId = row[C_ID_COL].data<int>();
329  destination.key = row[AUTH_KEY_COL].data<std::string>();
330  found = true;
331  }
332  return found;
333  }
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")
def query(query_str, verbose=False)
Definition: das.py:5
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 251 of file CredentialStore.cc.

References COND_CREDENTIAL_TABLE(), CONNECTION_ID_COL(), CONNECTION_KEY_COL(), CONNECTION_LABEL_COL(), cond::CredentialData::connectionKey, runEdmFileComparison::found, cond::CredentialData::id, cond::CredentialData::password, PASSWORD_COL(), das::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().

253  {
254 
255  std::auto_ptr<coral::IQuery> query(schema.tableHandle(COND_CREDENTIAL_TABLE).newQuery());
256  coral::AttributeList readBuff;
257  readBuff.extend<int>( CONNECTION_ID_COL );
258  readBuff.extend<std::string>( USERNAME_COL );
259  readBuff.extend<std::string>( PASSWORD_COL );
260  readBuff.extend<std::string>( VERIFICATION_KEY_COL );
261  readBuff.extend<std::string>( CONNECTION_KEY_COL );
262  coral::AttributeList whereData;
263  whereData.extend<std::string>( CONNECTION_LABEL_COL );
264  whereData[ CONNECTION_LABEL_COL ].data<std::string>() = connectionLabel;
265  std::string whereClause = CONNECTION_LABEL_COL + " = :" + CONNECTION_LABEL_COL;
266  query->defineOutput(readBuff);
267  query->addToOutputList( CONNECTION_ID_COL );
268  query->addToOutputList( USERNAME_COL );
269  query->addToOutputList( PASSWORD_COL );
270  query->addToOutputList( VERIFICATION_KEY_COL );
271  query->addToOutputList( CONNECTION_KEY_COL );
272  query->setCondition( whereClause, whereData );
273  coral::ICursor& cursor = query->execute();
274  bool found = false;
275  if ( cursor.next() ) {
276  const coral::AttributeList& row = cursor.currentRow();
277  destination.id = row[ CONNECTION_ID_COL].data<int>();
278  destination.userName = row[ USERNAME_COL].data<std::string>();
279  destination.password = row[ PASSWORD_COL].data<std::string>();
280  destination.verificationKey = row[ VERIFICATION_KEY_COL].data<std::string>();
281  destination.connectionKey = row[ CONNECTION_KEY_COL].data<std::string>();
282  found = true;
283  }
284  return found;
285  }
static const std::string PASSWORD_COL("CRED5")
def query(query_str, verbose=False)
Definition: das.py:5
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 204 of file CredentialStore.cc.

References ADMIN_KEY_COL(), cond::PrincipalData::adminKey, COND_AUTHENTICATION_TABLE(), runEdmFileComparison::found, cond::PrincipalData::id, PRINCIPAL_ID_COL(), PRINCIPAL_KEY_COL(), PRINCIPAL_NAME_COL(), cond::PrincipalData::principalKey, das::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().

206  {
207 
208  std::auto_ptr<coral::IQuery> query(schema.tableHandle(COND_AUTHENTICATION_TABLE).newQuery());
209  coral::AttributeList readBuff;
210  readBuff.extend<int>(PRINCIPAL_ID_COL);
211  readBuff.extend<std::string>(VERIFICATION_COL);
212  readBuff.extend<std::string>(PRINCIPAL_KEY_COL);
213  readBuff.extend<std::string>(ADMIN_KEY_COL);
214  coral::AttributeList whereData;
215  whereData.extend<std::string>(PRINCIPAL_NAME_COL);
216  whereData[ PRINCIPAL_NAME_COL ].data<std::string>() = principal;
217  std::string whereClause = PRINCIPAL_NAME_COL + " = :" + PRINCIPAL_NAME_COL;
218  query->defineOutput(readBuff);
219  query->addToOutputList( PRINCIPAL_ID_COL );
220  query->addToOutputList( VERIFICATION_COL );
221  query->addToOutputList( PRINCIPAL_KEY_COL );
222  query->addToOutputList( ADMIN_KEY_COL );
223  query->setCondition( whereClause, whereData );
224  coral::ICursor& cursor = query->execute();
225  bool found = false;
226  if ( cursor.next() ) {
227  found = true;
228  const coral::AttributeList& row = cursor.currentRow();
229  destination.id = row[ PRINCIPAL_ID_COL ].data<int>();
230  destination.verifKey = row[ VERIFICATION_COL ].data<std::string>();
231  destination.principalKey = row[ PRINCIPAL_KEY_COL ].data<std::string>();
232  destination.adminKey = row[ ADMIN_KEY_COL ].data<std::string>();
233  }
234  return found;
235  }
static const std::string COND_AUTHENTICATION_TABLE("COND_AUTHENTICATION")
def query(query_str, verbose=False)
Definition: das.py:5
Definition: query.py:1
def principal(options)
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 62 of file Serialization.h.

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

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

62  {
63  std::pair<Binary,Binary> ret;
64  std::string streamerInfo( StreamerInfo::jsonString() );
65  try{
66  // save data to buffers
67  std::ostringstream dataBuffer;
68  CondOutputArchive oa( dataBuffer );
69  oa << payload;
70  //TODO: avoid (2!!) copies
71  ret.first.copy( dataBuffer.str() );
72  ret.second.copy( streamerInfo );
73  } catch ( const std::exception& e ){
74  std::string em( e.what() );
75  throwException("Serialization failed: "+em+". Serialization info:"+streamerInfo,"serialize");
76  }
77  return ret;
78  }
cond::serialization::OutputArchive CondOutputArchive
Definition: Serialization.h:59
void throwException(const std::string &message, const std::string &methodName)
Definition: Exception.cc:14
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 427 of file CredentialStore.cc.

References AUTH_ID_COL(), AUTH_KEY_COL(), cond::auth::Cipher::b64encrypt(), C_ID_COL(), COND_AUTHORIZATION_TABLE(), idDealer::editor, runEdmFileComparison::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().

433  {
434  auth::Cipher cipher( principalKey );
435  std::string encryptedConnectionKey = cipher.b64encrypt( connectionKey );
436  AuthorizationData authData;
437  bool found = selectAuthorization( schema, principalId, role, connectionString, authData );
438 
439  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHORIZATION_TABLE).dataEditor();
440  if( found ) {
441  coral::AttributeList updateData;
442  updateData.extend<int>( AUTH_ID_COL );
443  updateData.extend<int>( C_ID_COL );
444  updateData.extend<std::string>( AUTH_KEY_COL );
445  updateData[ AUTH_ID_COL ].data<int>() = authData.id;
446  updateData[ C_ID_COL ].data<int>() = connectionId;
447  updateData[ AUTH_KEY_COL ].data<std::string>() = encryptedConnectionKey;
448  std::string setCl = C_ID_COL+" = :"+C_ID_COL + ", "+AUTH_KEY_COL+" = :"+AUTH_KEY_COL;
449  std::string whereCl = AUTH_ID_COL+" = :"+AUTH_ID_COL;
450  editor.updateRows( setCl,whereCl, updateData );
451  } else {
452 
453  int next = -1;
454  if( !getNextSequenceValue( schema, COND_AUTHORIZATION_TABLE, next ) ) throwException( "Can't find "+COND_AUTHORIZATION_TABLE+" sequence.","CredentialStore::setPermission" );
455 
456  coral::AttributeList insertData;
457  insertData.extend<int>( AUTH_ID_COL );
458  insertData.extend<int>( P_ID_COL );
459  insertData.extend<std::string>( ROLE_COL );
460  insertData.extend<std::string>( SCHEMA_COL );
461  insertData.extend<std::string>( AUTH_KEY_COL );
462  insertData.extend<int>( C_ID_COL );
463  insertData[ AUTH_ID_COL ].data<int>() = next;
464  insertData[ P_ID_COL ].data<int>() = principalId;
465  insertData[ ROLE_COL ].data<std::string>() = role;
466  insertData[ SCHEMA_COL ].data<std::string>() = connectionString;
467  insertData[ AUTH_KEY_COL ].data<std::string>() = encryptedConnectionKey;
468  insertData[ C_ID_COL ].data<int>() = connectionId;
469  editor.insertRow( insertData );
470  }
471  return true;
472  }
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:14
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 50 of file Types.cc.

References mps_fire::i, and throwException().

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

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

Definition at line 46 of file Types.cc.

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

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

Definition at line 21 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::KeyList::load(), cond::persistency::IOVEditor::load(), cond::service::PoolDBOutputService::lookUpRecord(), cond::CredentialStore::removeConnection(), cond::CredentialStore::removePrincipal(), cond::CredentialStore::resetAdmin(), serialize(), cond::CredentialStore::setPermission(), cond::CredentialStore::setUpForService(), cond::Binary::size(), synchronizationTypeFromName(), cond::CredentialStore::unsetPermission(), and cond::CredentialStore::updatePrincipal().

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

Definition at line 15 of file Time.cc.

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

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

15  {
16  static const std::string local[]=
17  {"runnumber","timestamp","lumiid","hash","userid"};
18  return local[i];
19  }
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 474 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, idDealer::editor, runEdmFileComparison::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().

479  {
480  CredentialData credsData;
481  bool found = selectConnection( schema, connectionLabel, credsData );
482  int connId = credsData.id;
483 
484  auth::Cipher adminCipher( adminKey );
485  std::string connectionKey("");
486  coral::ITableDataEditor& editor = schema.tableHandle(COND_CREDENTIAL_TABLE).dataEditor();
487  if( found ){
488 
489  connectionKey = adminCipher.b64decrypt( credsData.connectionKey );
490  auth::Cipher cipher( connectionKey );
491  std::string verificationKey = cipher.b64decrypt( credsData.verificationKey );
492  if( verificationKey != connectionLabel ){
493  throwException("Decoding of connection key failed.","CredentialStore::updateConnection");
494  }
495  if( forceUpdate ){
496  std::string encryptedUserName = cipher.b64encrypt( userName );
497  std::string encryptedPassword = cipher.b64encrypt( password );
498 
499  coral::AttributeList updateData;
500  updateData.extend<int>( CONNECTION_ID_COL );
501  updateData.extend<std::string>( USERNAME_COL );
502  updateData.extend<std::string>( PASSWORD_COL );
503  updateData[ CONNECTION_ID_COL ].data<int>() = connId;
504  updateData[ USERNAME_COL ].data<std::string>() = encryptedUserName;
505  updateData[ PASSWORD_COL ].data<std::string>() = encryptedPassword;
506  std::stringstream setCl;
507  setCl << USERNAME_COL << " = :" << USERNAME_COL;
508  setCl <<", " << PASSWORD_COL << " = :" << PASSWORD_COL;
510  editor.updateRows( setCl.str(),whereCl, updateData );
511  }
512  }
513 
514  if(!found){
515 
516  auth::KeyGenerator gen;
517  connectionKey = gen.make( auth::COND_DB_KEY_SIZE );
518  auth::Cipher cipher( connectionKey );
519  std::string encryptedUserName = cipher.b64encrypt( userName );
520  std::string encryptedPassword = cipher.b64encrypt( password );
521  std::string encryptedLabel = cipher.b64encrypt( connectionLabel );
522 
523  if( !getNextSequenceValue( schema, COND_CREDENTIAL_TABLE, connId ) ) throwException( "Can't find "+COND_CREDENTIAL_TABLE+" sequence.","CredentialStore::updateConnection" );
524 
525  coral::AttributeList insertData;
526  insertData.extend<int>( CONNECTION_ID_COL );
527  insertData.extend<std::string>( CONNECTION_LABEL_COL );
528  insertData.extend<std::string>( USERNAME_COL );
529  insertData.extend<std::string>( PASSWORD_COL );
530  insertData.extend<std::string>( VERIFICATION_KEY_COL );
531  insertData.extend<std::string>( CONNECTION_KEY_COL );
532  insertData[ CONNECTION_ID_COL ].data<int>() = connId;
533  insertData[ CONNECTION_LABEL_COL ].data<std::string>() = connectionLabel;
534  insertData[ USERNAME_COL ].data<std::string>() = encryptedUserName;
535  insertData[ PASSWORD_COL ].data<std::string>() = encryptedPassword;
536  insertData[ VERIFICATION_KEY_COL ].data<std::string>() = encryptedLabel;
537  insertData[ CONNECTION_KEY_COL ].data<std::string>() = adminCipher.b64encrypt( connectionKey ) ;;
538  editor.insertRow( insertData );
539 
540  }
541  return std::make_pair( connId, connectionKey );
542  }
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:14
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 370 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, idDealer::editor, runEdmFileComparison::found, relval_steps::gen(), getNextSequenceValue(), cond::PrincipalData::id, init, 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().

374  {
375  PrincipalData princData;
376  bool found = selectPrincipal( schema, principalName, princData );
377 
378  auth::Cipher cipher0( authenticationKey );
379  auth::Cipher cipher1( adminKey );
380 
381  std::string verifStr = cipher0.b64encrypt( principalName );
382  std::string principalKey("");
383  int principalId = princData.id;
384 
385  coral::ITableDataEditor& editor = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
386  if( found ){
387  principalKey = cipher1.b64decrypt( princData.adminKey );
388  coral::AttributeList updateData;
389  updateData.extend<int>( PRINCIPAL_ID_COL );
390  updateData.extend<std::string>( VERIFICATION_COL );
391  updateData.extend<std::string>( PRINCIPAL_KEY_COL );
392  updateData.extend<std::string>( ADMIN_KEY_COL );
393  updateData[ PRINCIPAL_ID_COL ].data<int>() = principalId;
394  updateData[ VERIFICATION_COL ].data<std::string>() = verifStr;
395  updateData[ PRINCIPAL_KEY_COL ].data<std::string>() = cipher0.b64encrypt( principalKey );
396  updateData[ ADMIN_KEY_COL ].data<std::string>() = cipher1.b64encrypt( principalKey );
397  std::stringstream setClause;
398  setClause << VERIFICATION_COL <<" = :" <<VERIFICATION_COL <<", ";
399  setClause << PRINCIPAL_KEY_COL << " = :" << PRINCIPAL_KEY_COL <<", ";
400  setClause << ADMIN_KEY_COL << " = :" << ADMIN_KEY_COL;
401  std::string whereClause = PRINCIPAL_ID_COL+" = :"+PRINCIPAL_ID_COL;
402  editor.updateRows( setClause.str(),whereClause, updateData );
403  } else {
404  if( init ){
405  principalKey = adminKey;
406  } else {
407  auth::KeyGenerator gen;
408  principalKey = gen.make( auth::COND_DB_KEY_SIZE );
409  }
410  coral::ITableDataEditor& editor0 = schema.tableHandle(COND_AUTHENTICATION_TABLE).dataEditor();
411 
412  if( !getNextSequenceValue( schema, COND_AUTHENTICATION_TABLE, principalId ) ) throwException( "Can't find "+COND_AUTHENTICATION_TABLE+" sequence.","CredentialStore::updatePrincipal" );
413 
414  coral::AttributeList authData;
415  editor0.rowBuffer(authData);
416  authData[ PRINCIPAL_ID_COL ].data<int>() = principalId;
417  authData[ PRINCIPAL_NAME_COL ].data<std::string>() = principalName;
418  authData[ VERIFICATION_COL ].data<std::string>() = verifStr;
419  authData[ PRINCIPAL_KEY_COL ].data<std::string>() = cipher0.b64encrypt( principalKey );
420  authData[ ADMIN_KEY_COL ].data<std::string>() = cipher1.b64encrypt( principalKey );
421  editor0.insertRow( authData );
422  }
423 
424  return std::make_pair(principalId,principalKey);
425  }
int init
Definition: HydjetWrapper.h:67
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)
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:14
static const std::string PRINCIPAL_NAME_COL("P_NAME")

Variable Documentation

constexpr unsigned int cond::HASH_SIZE = 40
static

Definition at line 46 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 42 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 32 of file Types.cc.

const unsigned int cond::TIMETYPE_LIST_MAX =5

Definition at line 22 of file Time.h.

Referenced by findSpecs().

const cond::TimeType cond::timeTypeList
Initial value:

Definition at line 9 of file Time.cc.

const TimeTypeSpecs cond::timeTypeSpecs
const cond::TimeType cond::timeTypeValues
Initial value:

Definition at line 12 of file Time.cc.