Coding style fixes

This commit is contained in:
Felipe Zimmerle
2017-11-13 14:22:17 -03:00
parent 023e7acbad
commit 3fb71f32d8
40 changed files with 591 additions and 662 deletions

View File

@@ -13,10 +13,11 @@
*
*/
#include <unistd.h>
#include <string>
#include <memory>
#include <unistd.h>
#define NUM_THREADS 100
@@ -151,8 +152,9 @@ class ReadingLogsViaRuleMessage {
dms.rules = rules;
for (i = 0; i < NUM_THREADS; i++) {
pthread_create(&threads[i], NULL, process_request, (void *)&dms);
//process_request((void *)&dms);
pthread_create(&threads[i], NULL, process_request,
reinterpret_cast<void *>(&dms));
// process_request((void *)&dms);
}
usleep(10000);

View File

@@ -23,14 +23,13 @@
int main(int argc, char **argv) {
*argv++;
if (*argv == NULL) {
*argv--;
if (argc < 2) {
std::cout << "Use " << *argv << " test-case-file.conf";
std::cout << std::endl << std::endl;
return -1;
}
*(argv++);
std::string rules(*argv);
ReadingLogsViaRuleMessage rlvrm(request_header, request_uri, request_body,
response_headers, response_body, ip, rules);

View File

@@ -35,14 +35,11 @@ SecRule REQUEST_HEADERS:Content-Type "application/json" \
# to the size of data, with files excluded. You want to keep that value as
# low as practical.
#
SecRequestBodyLimit 13107200
SecRequestBodyNoFilesLimit 131072
# Store up to 128 KB of request body data in memory. When the multipart
# parser reachers this limit, it will start using your hard disk for
# storage. That is slow, but unavoidable.
#
SecRequestBodyInMemoryLimit 131072
# What do do if the request body size is above our configured limit.
# Keep in mind that this setting will automatically be set to ProcessPartial

View File

@@ -13,18 +13,20 @@
*
*/
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <string>
#include <memory>
#include <unistd.h>
#include <modsecurity/modsecurity.h>
#include <modsecurity/rules.h>
#include <modsecurity/rule_message.h>
#include <string>
#include <memory>
char request_uri[] = "/test.pl?param1=test&para2=test2";
@@ -85,8 +87,7 @@ static void logCb(void *data, const void *ruleMessagev) {
}
}
int process_intervention(modsecurity::Transaction *transaction)
{
int process_intervention(modsecurity::Transaction *transaction) {
modsecurity::ModSecurityIntervention intervention;
intervention.status = 200;
intervention.url = NULL;
@@ -105,8 +106,7 @@ int process_intervention(modsecurity::Transaction *transaction)
free(intervention.log);
intervention.log = NULL;
if (intervention.url != NULL)
{
if (intervention.url != NULL) {
std::cout << "Intervention, redirect to: " << intervention.url;
std::cout << " with status code: " << intervention.status << std::endl;
free(intervention.url);
@@ -114,8 +114,7 @@ int process_intervention(modsecurity::Transaction *transaction)
return intervention.status;
}
if (intervention.status != 200)
{
if (intervention.status != 200) {
std::cout << "Intervention, returning code: " << intervention.status;
std::cout << std::endl;
return intervention.status;
@@ -129,13 +128,12 @@ int main(int argc, char **argv) {
modsecurity::Rules *rules;
modsecurity::ModSecurityIntervention it;
*argv++;
if (*argv == NULL) {
*argv--;
if (argc < 2) {
std::cout << "Use " << *argv << " test-case-file.conf";
std::cout << std::endl << std::endl;
return -1;
}
*(argv++);
std::string rules_arg(*argv);