mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 19:24:29 +03:00
Code cosmetic: Having the code following our coding style
This commit also update some methods parameters to const.
This commit is contained in:
@@ -44,7 +44,7 @@ void Redirect::fill_intervention(ModSecurityIntervention *i) {
|
||||
i->status = this->status;
|
||||
}
|
||||
// reinterpret_cast<char *>
|
||||
i->url = (char *) this->url.c_str(); //** TODO: wheee */
|
||||
i->url = this->url.c_str(); //** TODO: wheee */
|
||||
i->log = "Redirecting";
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,8 @@ std::string& CompressWhitespace::evaluate(std::string value,
|
||||
/**
|
||||
* @todo Implement the transformation CompressWhitespace
|
||||
*/
|
||||
assay->debug(4, "Transformation CompressWhitespace is not implemented yet.");
|
||||
assay->debug(4, "Transformation CompressWhitespace is " \
|
||||
"not implemented yet.");
|
||||
}
|
||||
|
||||
} // namespace transformations
|
||||
|
@@ -41,4 +41,4 @@ class HexDecode : public Transformation {
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_HEX_DECODE_H_
|
||||
|
@@ -18,8 +18,8 @@
|
||||
#include "actions/action.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_
|
||||
#define SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_HEX_ENCODE_H_
|
||||
#define SRC_ACTIONS_TRANSFORMATIONS_HEX_ENCODE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ModSecurity {
|
||||
@@ -41,4 +41,4 @@ class HexEncode : public Transformation {
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_BASE64DECODE_H_
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_HEX_ENCODE_H_
|
||||
|
@@ -41,4 +41,4 @@ class ParityOdd7bit : public Transformation {
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_PARITY_EVEN_7BIT_H_
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_PARITY_ODD_7BIT_H_
|
||||
|
@@ -40,7 +40,8 @@ std::string& RemoveComments::evaluate(std::string value,
|
||||
/**
|
||||
* @todo Implement the transformation RemoveComments
|
||||
*/
|
||||
assay->debug(4, "Transformation RemoveComments is not implemented yet.");
|
||||
assay->debug(4, "Transformation RemoveComments is not " \
|
||||
"implemented yet.");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,8 @@ std::string& RemoveCommentsChar::evaluate(std::string value,
|
||||
/**
|
||||
* @todo Implement the transformation RemoveCommentsChar
|
||||
*/
|
||||
assay->debug(4, "Transformation RemoveCommentsChar is not implemented yet.");
|
||||
assay->debug(4, "Transformation RemoveCommentsChar " \
|
||||
"is not implemented yet.");
|
||||
return value;
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,6 @@
|
||||
#include "actions/transformations/replace_nulls.h"
|
||||
#include "actions/transformations/sha1.h"
|
||||
#include "actions/transformations/sql_hex_decode.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
#include "actions/transformations/trim.h"
|
||||
#include "actions/transformations/trim_left.h"
|
||||
#include "actions/transformations/trim_right.h"
|
||||
@@ -79,7 +78,6 @@ std::string &Transformation::evaluate(std::string value,
|
||||
}
|
||||
|
||||
Transformation* Transformation::instantiate(std::string a) {
|
||||
|
||||
IF_MATCH(base64_decode_ext) { return new Base64DecodeExt(a); }
|
||||
IF_MATCH(base64_decode) { return new Base64Decode(a); }
|
||||
IF_MATCH(cmd_line) { return new CmdLine(a); }
|
||||
@@ -115,7 +113,7 @@ Transformation* Transformation::instantiate(std::string a) {
|
||||
IF_MATCH(url_decode_uni) { return new UrlDecodeUni(a); }
|
||||
IF_MATCH(url_encode) { return new UrlEncode(a); }
|
||||
IF_MATCH(utf8_to_unicode) { return new Utf8Unicode(a); }
|
||||
|
||||
|
||||
return new Transformation(a);
|
||||
}
|
||||
|
||||
|
@@ -30,7 +30,7 @@ namespace ModSecurity {
|
||||
namespace actions {
|
||||
namespace transformations {
|
||||
|
||||
|
||||
|
||||
TrimRight::TrimRight(std::string action)
|
||||
: Trim(action) {
|
||||
this->action_kind = 1;
|
||||
|
@@ -42,4 +42,4 @@ class TrimRight : public Trim {
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_TRIM_H_
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_TRIM_RIGHT_H_
|
||||
|
@@ -18,8 +18,8 @@
|
||||
#include "actions/action.h"
|
||||
#include "actions/transformations/transformation.h"
|
||||
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_
|
||||
#define SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_
|
||||
#ifndef SRC_ACTIONS_TRANSFORMATIONS_UTF8_TO_UNICODE_H_
|
||||
#define SRC_ACTIONS_TRANSFORMATIONS_UTF8_TO_UNICODE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
namespace ModSecurity {
|
||||
@@ -41,4 +41,4 @@ class Utf8Unicode : public Transformation {
|
||||
|
||||
#endif
|
||||
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_UTF8_UNICODE_H_
|
||||
#endif // SRC_ACTIONS_TRANSFORMATIONS_UTF8_TO_UNICODE_H_
|
||||
|
10
src/assay.cc
10
src/assay.cc
@@ -118,7 +118,7 @@ void Assay::debug(int level, std::string message) {
|
||||
* @retval false Operation failed.
|
||||
*
|
||||
*/
|
||||
int Assay::processConnection(char *ipAddress) {
|
||||
int Assay::processConnection(const char *ipAddress) {
|
||||
this->m_ipAddress = ipAddress;
|
||||
debug(4, "Transaction context created (blah blah)");
|
||||
debug(4, "Starting phase CONNECTION. (SecRules 0)");
|
||||
@@ -149,10 +149,10 @@ int Assay::processConnection(char *ipAddress) {
|
||||
* @retval false Operation failed.
|
||||
*
|
||||
*/
|
||||
int Assay::processURI(char *uri) {
|
||||
int Assay::processURI(const char *uri) {
|
||||
debug(4, "Starting phase URI. (SecRules 0 + 1/2)");
|
||||
|
||||
char *pos = strchr(uri, '?');
|
||||
const char *pos = strchr(uri, '?');
|
||||
|
||||
if (pos != NULL && strlen(pos) > 2) {
|
||||
/**
|
||||
@@ -711,7 +711,7 @@ extern "C" Assay *msc_new_assay(ModSecurity *ms,
|
||||
* @retval 0 Operation failed.
|
||||
*
|
||||
*/
|
||||
extern "C" int msc_process_connection(Assay *assay, char *buf) {
|
||||
extern "C" int msc_process_connection(Assay *assay, const char *buf) {
|
||||
return assay->processConnection(buf);
|
||||
}
|
||||
|
||||
@@ -737,7 +737,7 @@ extern "C" int msc_process_connection(Assay *assay, char *buf) {
|
||||
* @retval 0 Operation failed.
|
||||
*
|
||||
*/
|
||||
extern "C" int msc_process_uri(Assay *assay, char *buf) {
|
||||
extern "C" int msc_process_uri(Assay *assay, const char *buf) {
|
||||
return assay->processURI(buf);
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,7 @@ int Driver::parseFile(const std::string &f) {
|
||||
parser.set_debug_level(trace_parsing);
|
||||
int res = parser.parse();
|
||||
|
||||
//std::cout << "Leaving the parser: " << res << std::endl;
|
||||
// std::cout << "Leaving the parser: " << res << std::endl;
|
||||
|
||||
scan_end();
|
||||
return res;
|
||||
|
@@ -105,7 +105,7 @@ int Rules::loadRemote(char *key, char *uri) {
|
||||
}
|
||||
|
||||
|
||||
int Rules::load(char *plain_rules) {
|
||||
int Rules::load(const char *plain_rules) {
|
||||
bool ret = true;
|
||||
/**
|
||||
* @todo rgg. we should make the parser work out of the buffer.
|
||||
@@ -252,7 +252,7 @@ extern "C" int msc_rules_add_file(Rules *rules, char *file) {
|
||||
}
|
||||
|
||||
|
||||
extern "C" int msc_rules_add(Rules *rules, char *plain_rules) {
|
||||
extern "C" int msc_rules_add(Rules *rules, const char *plain_rules) {
|
||||
rules->load(plain_rules);
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user