mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-15 23:55:03 +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) { }
|
ConfigInt() : m_set(false), m_value(0) { }
|
||||||
bool m_set;
|
bool m_set;
|
||||||
int m_value;
|
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) { }
|
ConfigDouble() : m_set(false), m_value(0) { }
|
||||||
bool m_set;
|
bool m_set;
|
||||||
double m_value;
|
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("") { }
|
ConfigString() : m_set(false), m_value("") { }
|
||||||
bool m_set;
|
bool m_set;
|
||||||
std::string m_value;
|
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;
|
to->m_tmpSaveUploadedFiles = from->m_tmpSaveUploadedFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from->m_requestBodyLimit.m_set == true) {
|
to->m_requestBodyLimit.merge(&from->m_requestBodyLimit);
|
||||||
to->m_requestBodyLimit.m_value = from->m_requestBodyLimit.m_value;
|
to->m_responseBodyLimit.merge(&from->m_responseBodyLimit);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from->m_requestBodyLimitAction != PropertyNotSetBodyLimitAction) {
|
if (from->m_requestBodyLimitAction != PropertyNotSetBodyLimitAction) {
|
||||||
to->m_requestBodyLimitAction = from->m_requestBodyLimitAction;
|
to->m_requestBodyLimitAction = from->m_requestBodyLimitAction;
|
||||||
@ -359,45 +379,18 @@ class RulesProperties {
|
|||||||
to->m_responseBodyLimitAction = from->m_responseBodyLimitAction;
|
to->m_responseBodyLimitAction = from->m_responseBodyLimitAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from->m_uploadFileLimit.m_set == true) {
|
to->m_uploadFileLimit.merge(&from->m_uploadFileLimit);
|
||||||
to->m_uploadFileLimit.m_value = from->m_uploadFileLimit.m_value;
|
to->m_uploadFileMode.merge(&from->m_uploadFileMode);
|
||||||
to->m_uploadFileLimit.m_set = true;
|
to->m_uploadDirectory.merge(&from->m_uploadDirectory);
|
||||||
}
|
to->m_uploadTmpDirectory.merge(&from->m_uploadTmpDirectory);
|
||||||
|
|
||||||
if (from->m_uploadFileMode.m_set == true) {
|
to->m_secArgumentSeparator.merge(&from->m_secArgumentSeparator);
|
||||||
to->m_uploadFileMode.m_value = from->m_uploadFileMode.m_value;
|
|
||||||
to->m_uploadFileMode.m_set = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (from->m_uploadDirectory.m_set == true) {
|
to->m_secWebAppId.merge(&from->m_secWebAppId);
|
||||||
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_unicodeMapTable.merge(&from->m_unicodeMapTable);
|
to->m_unicodeMapTable.merge(&from->m_unicodeMapTable);
|
||||||
|
|
||||||
if (from->m_httpblKey.m_set == true) {
|
to->m_httpblKey.merge(&from->m_httpblKey);
|
||||||
to->m_httpblKey.m_value = from->m_httpblKey.m_value;
|
|
||||||
to->m_httpblKey.m_set = from->m_httpblKey.m_set;
|
|
||||||
}
|
|
||||||
|
|
||||||
to->m_exceptions.merge(&from->m_exceptions);
|
to->m_exceptions.merge(&from->m_exceptions);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user