Adds md5 transformation

Replaced the old md5 implementation by the mbetls one.
This commit is contained in:
Felipe Zimmerle
2016-05-24 21:26:29 -03:00
parent bf4a9d7633
commit 7ccf54d330
9 changed files with 686 additions and 472 deletions

View File

@@ -24,30 +24,21 @@
#include "modsecurity/transaction.h"
#include "actions/transformations/transformation.h"
#include "src/utils/md5.h"
namespace modsecurity {
namespace actions {
namespace transformations {
Md5::Md5(std::string action)
: Transformation(action) {
this->action_kind = 1;
}
std::string Md5::evaluate(std::string value,
Transaction *transaction) {
/**
* @todo Implement the transformation Md5
*/
if (transaction) {
#ifndef NO_LOGS
transaction->debug(4, "Transformation Md5 is not implemented yet.");
#endif
}
return value;
std::string ret = Utils::Md5::digest(value);
return ret;
}
} // namespace transformations
} // namespace actions
} // namespace modsecurity

View File

@@ -30,9 +30,9 @@ namespace transformations {
class Md5 : public Transformation {
public:
explicit Md5(std::string action);
std::string
evaluate(std::string exp,
explicit Md5(std::string action) : Transformation(action) { }
std::string evaluate(std::string exp,
Transaction *transaction) override;
};