mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Fix LMDB compile error
This commit is contained in:
committed by
Felipe Zimmerle
parent
854a661a2a
commit
8d61a3df90
@@ -36,7 +36,7 @@ namespace backend {
|
|||||||
#ifdef WITH_LMDB
|
#ifdef WITH_LMDB
|
||||||
|
|
||||||
|
|
||||||
LMDB::LMDB() : m_env(NULL) {
|
LMDB::LMDB() : Collection(""), m_env(NULL) {
|
||||||
mdb_env_create(&m_env);
|
mdb_env_create(&m_env);
|
||||||
mdb_env_open(m_env, "./modsec-shared-collections",
|
mdb_env_open(m_env, "./modsec-shared-collections",
|
||||||
MDB_WRITEMAP | MDB_NOSUBDIR, 0664);
|
MDB_WRITEMAP | MDB_NOSUBDIR, 0664);
|
||||||
@@ -262,7 +262,7 @@ end_txn:
|
|||||||
|
|
||||||
|
|
||||||
void LMDB::resolveSingleMatch(const std::string& var,
|
void LMDB::resolveSingleMatch(const std::string& var,
|
||||||
std::vector<const Variable *> *l) {
|
std::vector<const VariableValue *> *l) {
|
||||||
int rc;
|
int rc;
|
||||||
MDB_txn *txn;
|
MDB_txn *txn;
|
||||||
MDB_dbi dbi;
|
MDB_dbi dbi;
|
||||||
@@ -290,8 +290,7 @@ void LMDB::resolveSingleMatch(const std::string& var,
|
|||||||
std::string *a = new std::string(
|
std::string *a = new std::string(
|
||||||
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
reinterpret_cast<char *>(mdb_value_ret.mv_data),
|
||||||
mdb_value_ret.mv_size);
|
mdb_value_ret.mv_size);
|
||||||
Variable *v = new Variable(&var, a);
|
VariableValue *v = new VariableValue(&var, a);
|
||||||
v->m_dynamic_value = true;
|
|
||||||
l->push_back(v);
|
l->push_back(v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +466,7 @@ end_txn:
|
|||||||
|
|
||||||
|
|
||||||
void LMDB::resolveMultiMatches(const std::string& var,
|
void LMDB::resolveMultiMatches(const std::string& var,
|
||||||
std::vector<const Variable *> *l) {
|
std::vector<const VariableValue *> *l) {
|
||||||
MDB_val key, data;
|
MDB_val key, data;
|
||||||
MDB_txn *txn = NULL;
|
MDB_txn *txn = NULL;
|
||||||
MDB_dbi dbi;
|
MDB_dbi dbi;
|
||||||
@@ -505,12 +504,11 @@ void LMDB::resolveMultiMatches(const std::string& var,
|
|||||||
if (strncmp(var.c_str(), a, keySize) != 0) {
|
if (strncmp(var.c_str(), a, keySize) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Variable *v = new Variable(
|
VariableValue *v = new VariableValue(
|
||||||
new std::string(reinterpret_cast<char *>(key.mv_data),
|
new std::string(reinterpret_cast<char *>(key.mv_data),
|
||||||
key.mv_size),
|
key.mv_size),
|
||||||
new std::string(reinterpret_cast<char *>(data.mv_data),
|
new std::string(reinterpret_cast<char *>(data.mv_data),
|
||||||
data.mv_size));
|
data.mv_size));
|
||||||
v->m_dynamic_value = true;
|
|
||||||
l->insert(l->begin(), v);
|
l->insert(l->begin(), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,7 +523,7 @@ end_txn:
|
|||||||
|
|
||||||
|
|
||||||
void LMDB::resolveRegularExpression(const std::string& var,
|
void LMDB::resolveRegularExpression(const std::string& var,
|
||||||
std::vector<const Variable *> *l) {
|
std::vector<const VariableValue *> *l) {
|
||||||
MDB_val key, data;
|
MDB_val key, data;
|
||||||
MDB_txn *txn = NULL;
|
MDB_txn *txn = NULL;
|
||||||
MDB_dbi dbi;
|
MDB_dbi dbi;
|
||||||
@@ -599,12 +597,11 @@ void LMDB::resolveRegularExpression(const std::string& var,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Variable *v = new Variable(
|
VariableValue *v = new VariableValue(
|
||||||
new std::string(reinterpret_cast<char *>(key.mv_data),
|
new std::string(reinterpret_cast<char *>(key.mv_data),
|
||||||
key.mv_size),
|
key.mv_size),
|
||||||
new std::string(reinterpret_cast<char *>(data.mv_data),
|
new std::string(reinterpret_cast<char *>(data.mv_data),
|
||||||
data.mv_size));
|
data.mv_size));
|
||||||
v->m_dynamic_value = true;
|
|
||||||
l->insert(l->begin(), v);
|
l->insert(l->begin(), v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,11 +65,11 @@ class LMDB :
|
|||||||
std::unique_ptr<std::string> resolveFirst(const std::string& var) override;
|
std::unique_ptr<std::string> resolveFirst(const std::string& var) override;
|
||||||
|
|
||||||
void resolveSingleMatch(const std::string& var,
|
void resolveSingleMatch(const std::string& var,
|
||||||
std::vector<const Variable *> *l) override;
|
std::vector<const VariableValue *> *l) override;
|
||||||
void resolveMultiMatches(const std::string& var,
|
void resolveMultiMatches(const std::string& var,
|
||||||
std::vector<const Variable *> *l) override;
|
std::vector<const VariableValue *> *l) override;
|
||||||
void resolveRegularExpression(const std::string& var,
|
void resolveRegularExpression(const std::string& var,
|
||||||
std::vector<const Variable *> *l) override;
|
std::vector<const VariableValue *> *l) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void string2val(const std::string& str, MDB_val *val);
|
void string2val(const std::string& str, MDB_val *val);
|
||||||
|
Reference in New Issue
Block a user