diff --git a/src/operators/inspect_file.cc b/src/operators/inspect_file.cc index 1ea1737de0..a72db488ed 100644 --- a/src/operators/inspect_file.cc +++ b/src/operators/inspect_file.cc @@ -73,10 +73,11 @@ bool InspectFile::evaluate(Transaction *transaction, const std::string &str) { pclose(in); res.append(s.str()); - if (res.size() > 1 && res.at(0) == '1') { - return true; + if (res.size() > 1 && res.at(0) != '1') { + return true; /* match */ } + /* no match */ return false; } } diff --git a/test/test-cases/regression/operator-inpectFile.json b/test/test-cases/regression/operator-inpectFile.json index 72cd6e2168..4252deae0c 100644 --- a/test/test-cases/regression/operator-inpectFile.json +++ b/test/test-cases/regression/operator-inpectFile.json @@ -19,7 +19,7 @@ "Content-Length": "27", "Content-Type": "application/x-www-form-urlencoded" }, - "uri":"/whee?res=0", + "uri":"/whee?res=1", "method":"GET", "body": [ ] }, @@ -57,7 +57,7 @@ "Content-Length": "27", "Content-Type": "application/x-www-form-urlencoded" }, - "uri":"/whee?res=1", + "uri":"/whee?res=0", "method":"GET", "body": [ ] }, @@ -106,7 +106,7 @@ ] }, "expected":{ - "debug_log":"Rule returned 0." + "debug_log":"Rule returned 1." }, "rules":[ "SecRuleEngine On",