-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Updated Code from PR #2304 #3371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v3/master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,6 +325,25 @@ extern "C" void msc_rules_error_cleanup(const char *error) { | |
free((void*) error); | ||
} | ||
|
||
extern "C" int msc_rules_reopen_audit_log(RulesSet *rules, const char **error) { | ||
bool succeeded = true; | ||
std::string errorStr; | ||
|
||
if (rules->m_auditLog != NULL) { | ||
succeeded = rules->m_auditLog->reopen(&errorStr); | ||
} | ||
|
||
if (!succeeded) { | ||
if (!errorStr.empty()) { | ||
*error = strdup(errorStr.c_str()); | ||
} else { | ||
// Guarantee an error message is always assigned in the event of a failure | ||
*error = strdup("Unknown error reopening audit log"); | ||
} | ||
} | ||
|
||
return succeeded ? 0 : -1; | ||
} | ||
|
||
Comment on lines
+328
to
347
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is a completely valid solution, but as you can see in other "C" API functions, the authors tied to avoid all the logic and use C++ types (like here the My suggestion here: create a thin wrapper, an "extra" function. You should add a new function to |
||
extern "C" int msc_rules_cleanup(RulesSet *rules) { | ||
delete rules; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,12 @@ shiftNegative:src/utils/msc_tree.cc | |
|
||
// | ||
// ModSecurity v3 code... | ||
// | ||
// | ||
|
||
functionConst:src/utils/shared_files.h:60 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally: please don't use this file to collect suppressions. If you need to add some suppression, please use an inline one. But here: why it this necessary? It seems in that file in line 60 there is only a condition... |
||
useInitializationList:src/utils/shared_files.h:88 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar here, but it seems that file only has 77 lines, so adding line 88 makes no sense. |
||
|
||
|
||
variableScope:src/operators/rx.cc | ||
variableScope:src/operators/rx_global.cc | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As Sonarcloud shows here you should use
nullptr
instead ofNULL
. I see there are many otherNULL
literals in this file - feel free to replace them.