mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 11:44:32 +03:00
Adds support to the transformation normalisePathWin
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
#include "actions/transformations/normalise_path_win.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
@@ -24,26 +26,28 @@
|
||||
|
||||
#include "modsecurity/assay.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
#include "src/utils.h"
|
||||
|
||||
|
||||
namespace ModSecurity {
|
||||
namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
NormalisePathWin::NormalisePathWin(std::string action)
|
||||
: Transformation(action) {
|
||||
this->action_kind = 1;
|
||||
}
|
||||
|
||||
std::string NormalisePathWin::evaluate(std::string value,
|
||||
Assay *assay) {
|
||||
/**
|
||||
* @todo Implement the transformation NormalisePathWin
|
||||
*/
|
||||
assay->debug(4, "Transformation NormalisePathWin is not implemented yet.");
|
||||
return value;
|
||||
int changed;
|
||||
char *tmp = strdup(value.c_str());
|
||||
int res = normalize_path_inplace((unsigned char *)tmp,
|
||||
value.size(), 1, &changed);
|
||||
std::string ret("");
|
||||
ret.assign(tmp);
|
||||
free(tmp);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
} // namespace transformations
|
||||
} // namespace actions
|
||||
} // namespace ModSecurity
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_
|
||||
#define SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
namespace ModSecurity {
|
||||
class Assay;
|
||||
|
||||
@@ -30,7 +30,9 @@ namespace transformations {
|
||||
|
||||
class NormalisePathWin : public Transformation {
|
||||
public:
|
||||
explicit NormalisePathWin(std::string action);
|
||||
explicit NormalisePathWin(std::string action)
|
||||
: Transformation(action) { }
|
||||
|
||||
std::string evaluate(std::string exp,
|
||||
Assay *assay) override;
|
||||
};
|
||||
@@ -39,6 +41,5 @@ class NormalisePathWin : public Transformation {
|
||||
} // namespace actions
|
||||
} // namespace ModSecurity
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_NORMALISE_PATH_WIN_H_
|
||||
|
@@ -88,7 +88,7 @@ Transformation* Transformation::instantiate(std::string a) {
|
||||
IF_MATCH(md5) { return new Md5(a); }
|
||||
IF_MATCH(none) { return new None(a); }
|
||||
IF_MATCH(normalise_path) { return new NormalisePath(a); }
|
||||
IF_MATCH(normalise_path_win) { return new NormalisePathWin(a); }
|
||||
IF_MATCH(normalisePathWin) { return new NormalisePathWin(a); }
|
||||
IF_MATCH(parity_even_7bit) { return new ParityEven7bit(a); }
|
||||
IF_MATCH(parity_odd_7bit) { return new ParityOdd7bit(a); }
|
||||
IF_MATCH(parity_zero_7bit) { return new ParityZero7bit(a); }
|
||||
|
Reference in New Issue
Block a user