mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Implemented merge() method for ConfigInt, ConfigDouble, ConfigString
This change makes the following directives to be merged properly: SecRequestBodyLimit SecResponseBodyLimit SecUploadFileLimit SecUploadFileMode SecUploadDir SecTmpDir SecArgumentSeparator SecWebAppId SecHttpBlKey
This commit is contained in:
parent
78b7fa4e2c
commit
2d11ff1a14
@ -54,6 +54,15 @@ class ConfigInt {
|
||||
ConfigInt() : m_set(false), m_value(0) { }
|
||||
bool m_set;
|
||||
int m_value;
|
||||
|
||||
void merge(ConfigInt *from) {
|
||||
if (m_set == true || from->m_set == false) {
|
||||
return;
|
||||
}
|
||||
m_set = true;
|
||||
m_value = from->m_value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -62,6 +71,15 @@ class ConfigDouble {
|
||||
ConfigDouble() : m_set(false), m_value(0) { }
|
||||
bool m_set;
|
||||
double m_value;
|
||||
|
||||
void merge(ConfigDouble *from) {
|
||||
if (m_set == true || from->m_set == false) {
|
||||
return;
|
||||
}
|
||||
m_set = true;
|
||||
m_value = from->m_value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -70,6 +88,15 @@ class ConfigString {
|
||||
ConfigString() : m_set(false), m_value("") { }
|
||||
bool m_set;
|
||||
std::string m_value;
|
||||
|
||||
void merge(ConfigString *from) {
|
||||
if (m_set == true || from->m_set == false) {
|
||||
return;
|
||||
}
|
||||
m_set = true;
|
||||
m_value = from->m_value;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -341,15 +368,8 @@ class RulesProperties {
|
||||
to->m_tmpSaveUploadedFiles = from->m_tmpSaveUploadedFiles;
|
||||
}
|
||||
|
||||
if (from->m_requestBodyLimit.m_set == true) {
|
||||
to->m_requestBodyLimit.m_value = from->m_requestBodyLimit.m_value;
|
||||
to->m_requestBodyLimit.m_set = true;
|
||||
}
|
||||
|
||||
if (from->m_responseBodyLimit.m_set == true) {
|
||||
to->m_responseBodyLimit.m_value = from->m_responseBodyLimit.m_value;
|
||||
to->m_responseBodyLimit.m_set = true;
|
||||
}
|
||||
to->m_requestBodyLimit.merge(&from->m_requestBodyLimit);
|
||||
to->m_responseBodyLimit.merge(&from->m_responseBodyLimit);
|
||||
|
||||
if (from->m_requestBodyLimitAction != PropertyNotSetBodyLimitAction) {
|
||||
to->m_requestBodyLimitAction = from->m_requestBodyLimitAction;
|
||||
@ -359,45 +379,18 @@ class RulesProperties {
|
||||
to->m_responseBodyLimitAction = from->m_responseBodyLimitAction;
|
||||
}
|
||||
|
||||
if (from->m_uploadFileLimit.m_set == true) {
|
||||
to->m_uploadFileLimit.m_value = from->m_uploadFileLimit.m_value;
|
||||
to->m_uploadFileLimit.m_set = true;
|
||||
}
|
||||
to->m_uploadFileLimit.merge(&from->m_uploadFileLimit);
|
||||
to->m_uploadFileMode.merge(&from->m_uploadFileMode);
|
||||
to->m_uploadDirectory.merge(&from->m_uploadDirectory);
|
||||
to->m_uploadTmpDirectory.merge(&from->m_uploadTmpDirectory);
|
||||
|
||||
if (from->m_uploadFileMode.m_set == true) {
|
||||
to->m_uploadFileMode.m_value = from->m_uploadFileMode.m_value;
|
||||
to->m_uploadFileMode.m_set = true;
|
||||
}
|
||||
to->m_secArgumentSeparator.merge(&from->m_secArgumentSeparator);
|
||||
|
||||
if (from->m_uploadDirectory.m_set == true) {
|
||||
to->m_uploadDirectory.m_value = from->m_uploadDirectory.m_value;
|
||||
to->m_uploadDirectory.m_set = true;
|
||||
}
|
||||
|
||||
if (from->m_uploadTmpDirectory.m_set == true) {
|
||||
to->m_uploadTmpDirectory.m_value = \
|
||||
from->m_uploadTmpDirectory.m_value;
|
||||
to->m_uploadTmpDirectory.m_set = true;
|
||||
}
|
||||
|
||||
if (from->m_secArgumentSeparator.m_set == true) {
|
||||
to->m_secArgumentSeparator.m_value = \
|
||||
from->m_secArgumentSeparator.m_value;
|
||||
to->m_secArgumentSeparator.m_set = true;
|
||||
}
|
||||
|
||||
if (from->m_secWebAppId.m_set == true) {
|
||||
to->m_secWebAppId.m_value = \
|
||||
from->m_secWebAppId.m_value;
|
||||
to->m_secWebAppId.m_set = true;
|
||||
}
|
||||
to->m_secWebAppId.merge(&from->m_secWebAppId);
|
||||
|
||||
to->m_unicodeMapTable.merge(&from->m_unicodeMapTable);
|
||||
|
||||
if (from->m_httpblKey.m_set == true) {
|
||||
to->m_httpblKey.m_value = from->m_httpblKey.m_value;
|
||||
to->m_httpblKey.m_set = from->m_httpblKey.m_set;
|
||||
}
|
||||
to->m_httpblKey.merge(&from->m_httpblKey);
|
||||
|
||||
to->m_exceptions.merge(&from->m_exceptions);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user