22#define RESIPROCATE_SUBSYSTEM Subsystem::REPRO
26 mTlsPeerAuthorizationQuery = config.
getConfigData(
"CustomTlsAuthQuery",
"");
27 mTableNamePrefix = config.
getConfigData(
"TableNamePrefix",
"");
37 userWhereClauseToDataStream(key, ds);
49 tlsPeerIdentityWhereClauseToDataStream(key, ds);
58 std::set<resip::Data>::const_iterator it = items.begin();
59 while(it != items.end())
61 if(it != items.begin())
67 ds << quote << *it << quote;
78SqlDb::isAuthorized(
const std::set<resip::Data>& peerNames,
const std::set<resip::Data>& identities)
const
80 std::vector<Data> ret;
84 StackLog(<<
"peerNameSet = " << peerNameSet);
88 StackLog(<<
"identitySet = " << identitySet);
91 if(mTlsPeerAuthorizationQuery.
empty())
95 ds <<
"authorizedIdentity IN (" << identitySet <<
");";
99 command = mTlsPeerAuthorizationQuery;
100 command.
replace(
"$peerNames", peerNameSet);
101 command.
replace(
"$identities", identitySet);
108 int count = ret.front().convertInt();
116SqlDb::dbEraseRecord(
const Table table,
124 ds <<
"DELETE FROM " <<
tableName(table);
127 ds <<
" WHERE attr2='" << escapeString(pKey, escapedKey) <<
"'";
131 ds <<
" WHERE attr='" << escapeString(pKey, escapedKey) <<
"'";
138SqlDb::dbCommitTransaction(
const Table table)
140 Data command(
"COMMIT");
141 return query(command) == 0;
145SqlDb::dbRollbackTransaction(
const Table table)
147 Data command(
"ROLLBACK");
148 return query(command) == 0;
172 return mTableNamePrefix +
aclsavp;
180 return mTableNamePrefix +
siloavp;
static const Data sep("[]")
#define resip_assert(x)
This file needs to work for both C and C++ code.
static const char staticregsavp[]
static const char siloavp[]
static const char configsavp[]
static const char aclsavp[]
static const char filtersavp[]
static const char userTable[]
static const char routesavp[]
static const char tlsPeerIdentityTable[]
virtual bool isAuthorized(const std::set< resip::Data > &peerNames, const std::set< resip::Data > &identities) const
virtual void eraseUser(const Key &key)
resip::Data tableName(Table table) const
SqlDb(const resip::ConfigParse &config)
virtual void eraseTlsPeerIdentity(const Key &key)
virtual int singleResultQuery(const resip::Data &queryCommand, std::vector< resip::Data > &fields) const =0
void setToData(const std::set< resip::Data > &items, resip::Data &result, const resip::Data &sep=",", const char quote='\'') const
resip::Data getConfigData(const resip::Data &name, const resip::Data &defaultValue, bool useDefaultIfEmpty=false) const
An iostream that operates on an existing Data.
An alternative to std::string, encapsulates an arbitrary buffer of bytes.
int replace(const Data &match, const Data &target, int max=INT_MAX)
Replaces up to max occurrences of the bytes match with target.
bool empty() const noexcept
Checks whether the Data is empty.
This Class is used to implement a primitive form of RPC using loose XML formatting.
dcm! – add UnusedChecking(_enum) below;