From dbcf5a719851a497026a72fc67a3903ec104ebf7 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 23 Mar 2017 09:52:39 -0300 Subject: [PATCH] API CHANGE: Rules::merge signature was change to includes error msg --- headers/modsecurity/rules.h | 2 +- src/rules.cc | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/headers/modsecurity/rules.h b/headers/modsecurity/rules.h index 6d01e0ea..71afebe0 100644 --- a/headers/modsecurity/rules.h +++ b/headers/modsecurity/rules.h @@ -99,7 +99,7 @@ extern "C" { Rules *msc_create_rules_set(); void msc_rules_dump(Rules *rules); -int msc_rules_merge(Rules *rules_dst, Rules *rules_from); +int msc_rules_merge(Rules *rules_dst, Rules *rules_from, const char **error); int msc_rules_add_remote(Rules *rules, const char *key, const char *uri, const char **error); int msc_rules_add_file(Rules *rules, const char *file, const char **error); diff --git a/src/rules.cc b/src/rules.cc index 0e406d9b..3faf1740 100644 --- a/src/rules.cc +++ b/src/rules.cc @@ -277,8 +277,12 @@ extern "C" void msc_rules_dump(Rules *rules) { extern "C" int msc_rules_merge(Rules *rules_dst, - Rules *rules_from) { - return rules_dst->merge(rules_from); + Rules *rules_from, const char **error) { + int ret = rules_dst->merge(rules_from); + if (ret < 0) { + *error = strdup(rules_dst->getParserError().c_str()); + } + return ret; }