Refactoring: Makes transformations to work with new execute signature

This commit is contained in:
Felipe Zimmerle
2019-02-26 15:39:27 -03:00
parent 3c0c4a8ba0
commit 7640f7b40b
93 changed files with 913 additions and 715 deletions

View File

@@ -32,28 +32,27 @@ namespace actions {
namespace transformations {
std::string ParityEven7bit::execute(const std::string &value,
Transaction *transaction) {
std::string ret;
void ParityEven7bit::execute(Transaction *t,
ModSecStackString &in,
ModSecStackString &out) {
unsigned char *input;
input = reinterpret_cast<unsigned char *>
(malloc(sizeof(char) * value.length()+1));
(malloc(sizeof(char) * in.length()+1));
if (input == NULL) {
return "";
return;
}
std::memcpy(input, value.c_str(), value.length()+1);
std::memcpy(input, in.c_str(), in.length()+1);
inplace(input, value.length());
inplace(input, in.length());
ret.assign(reinterpret_cast<char *>(input), value.length());
out.assign(reinterpret_cast<char *>(input), in.length());
free(input);
return ret;
}
bool ParityEven7bit::inplace(unsigned char *input, uint64_t input_len) {
uint64_t i;
@@ -76,7 +75,6 @@ bool ParityEven7bit::inplace(unsigned char *input, uint64_t input_len) {
}
} // namespace transformations
} // namespace actions
} // namespace modsecurity