mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-16 17:41:52 +03:00
Support expirevar for in-memory collection
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -106,6 +105,12 @@ class Global_DynamicElement : public Variable {
|
||||
t->m_rules->m_secWebAppId.m_value);
|
||||
}
|
||||
|
||||
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
|
||||
t->m_collections.m_global_collection->setExpiry(k,
|
||||
t->m_collections.m_global_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
|
||||
}
|
||||
|
||||
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
|
||||
const std::string &value) {
|
||||
t->m_collections.m_global_collection->storeOrUpdateFirst(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -105,6 +104,12 @@ class Ip_DynamicElement : public Variable {
|
||||
t->m_rules->m_secWebAppId.m_value);
|
||||
}
|
||||
|
||||
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
|
||||
t->m_collections.m_ip_collection->setExpiry(k,
|
||||
t->m_collections.m_ip_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
|
||||
}
|
||||
|
||||
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
|
||||
const std::string &value) {
|
||||
t->m_collections.m_ip_collection->storeOrUpdateFirst(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -105,6 +104,13 @@ class Resource_DynamicElement : public Variable {
|
||||
t->m_rules->m_secWebAppId.m_value);
|
||||
}
|
||||
|
||||
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
|
||||
t->m_collections.m_resource_collection->setExpiry(k,
|
||||
t->m_collections.m_resource_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
|
||||
}
|
||||
|
||||
|
||||
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
|
||||
const std::string &value) {
|
||||
t->m_collections.m_resource_collection->storeOrUpdateFirst(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -105,6 +104,12 @@ class Session_DynamicElement : public Variable {
|
||||
t->m_collections.m_ip_collection_key);
|
||||
}
|
||||
|
||||
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
|
||||
t->m_collections.m_session_collection->setExpiry(k,
|
||||
t->m_collections.m_session_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
|
||||
}
|
||||
|
||||
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
|
||||
const std::string &value) {
|
||||
t->m_collections.m_session_collection->storeOrUpdateFirst(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* ModSecurity, http://www.modsecurity.org/
|
||||
* Copyright (c) 2015 - 2021 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
* Copyright (c) 2015 - 2023 Trustwave Holdings, Inc. (http://www.trustwave.com/)
|
||||
*
|
||||
* You may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
@@ -105,6 +104,12 @@ class User_DynamicElement : public Variable {
|
||||
t->m_rules->m_secWebAppId.m_value);
|
||||
}
|
||||
|
||||
static void setExpiry(Transaction *t, const std::string &k, int32_t expiry_seconds) {
|
||||
t->m_collections.m_user_collection->setExpiry(k,
|
||||
t->m_collections.m_user_collection_key,
|
||||
t->m_rules->m_secWebAppId.m_value, expiry_seconds);
|
||||
}
|
||||
|
||||
static void storeOrUpdateFirst(Transaction *t, const std::string &var,
|
||||
const std::string &value) {
|
||||
t->m_collections.m_user_collection->storeOrUpdateFirst(
|
||||
|
||||
Reference in New Issue
Block a user