Skip to content

Fix parser to support GeoLookup with MaxMind #1895

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
v3.0.3 - YYYY-MMM-DD (to be released)
-------------------------------------

- Fix parser to support GeoLookup with MaxMind
[Issue #1884 - @victorhora, @everping]
- Fix pc file
[Issue #1847 - @gquintard]
- modsec_rules_check: uses the gnu `.la' instead of `.a' file
Expand Down
2 changes: 1 addition & 1 deletion build/libmaxmind.m4
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MAXMIND_POSSIBLE_LIB_NAMES="libmaxminddb maxminddb maxmind"
MAXMIND_POSSIBLE_EXTENSIONS="so la sl dll dylib"

# Possible paths (if pkg-config was not found, proceed with the file lookup)
MAXMIND_POSSIBLE_PATHS="/usr/local/libmaxmind /usr/local/maxmind /usr/local /opt/libmaxmind /opt/maxmind /opt /usr /opt/local/include /opt/local /usr/lib /usr/local/lib /usr/lib64 /usr"
MAXMIND_POSSIBLE_PATHS="/usr/local/libmaxmind /usr/local/maxmind /usr/local /opt/libmaxmind /opt/maxmind /opt /usr /opt/local/include /opt/local /usr/lib /usr/local/lib /usr/lib64 /usr /usr/include/x86_64-linux-gnu/"

# Variables to be set by this very own script.
MAXMIND_VERSION=""
Expand Down
10 changes: 5 additions & 5 deletions src/parser/seclang-parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ namespace yy {


// User initialization code.
#line 353 "/home/vhora/ModSecurity-v3-LATEST-JUNE/src/parser/seclang-parser.yy" // lalr1.cc:725
#line 353 "/home/vhora/ModSecurity-v3-AUGUST/src/parser/seclang-parser.yy" // lalr1.cc:725
{
// Initialize the initial location.
yyla.location.begin.filename = yyla.location.end.filename = &driver.file;
Expand Down Expand Up @@ -1757,11 +1757,11 @@ namespace yy {
case 71:
#line 1082 "seclang-parser.yy" // lalr1.cc:847
{
#ifdef WITH_GEOIP
#if defined(WITH_GEOIP) or defined(WITH_MAXMIND)
OPERATOR_CONTAINER(yylhs.value.as< std::unique_ptr<Operator> > (), new operators::GeoLookup());
#else
std::stringstream ss;
ss << "This version of ModSecurity was not compiled with GeoIP support.";
ss << "This version of ModSecurity was not compiled with GeoIP or MaxMind support.";
driver.error(yystack_[1].location, ss.str());
YYERROR;
#endif // WITH_GEOIP
Expand Down Expand Up @@ -2438,7 +2438,7 @@ namespace yy {
case 125:
#line 1557 "seclang-parser.yy" // lalr1.cc:847
{
#ifdef WITH_GEOIP
#if defined(WITH_GEOIP) or defined(WITH_MAXMIND)
std::string err;
std::string file = modsecurity::utils::find_resource(yystack_[0].value.as< std::string > (),
driver.ref.back(), &err);
Expand All @@ -2458,7 +2458,7 @@ namespace yy {
}
#else
std::stringstream ss;
ss << "This version of ModSecurity was not compiled with GeoIP support.";
ss << "This version of ModSecurity was not compiled with GeoIP or MaxMind support.";
driver.error(yystack_[1].location, ss.str());
YYERROR;
#endif // WITH_GEOIP
Expand Down
8 changes: 4 additions & 4 deletions src/parser/seclang-parser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -1080,11 +1080,11 @@ op_before_init:
}
| OPERATOR_GEOLOOKUP
{
#ifdef WITH_GEOIP
#if defined(WITH_GEOIP) or defined(WITH_MAXMIND)
OPERATOR_CONTAINER($$, new operators::GeoLookup());
#else
std::stringstream ss;
ss << "This version of ModSecurity was not compiled with GeoIP support.";
ss << "This version of ModSecurity was not compiled with GeoIP or MaxMind support.";
driver.error(@0, ss.str());
YYERROR;
#endif // WITH_GEOIP
Expand Down Expand Up @@ -1555,7 +1555,7 @@ expression:
/* Debug log: end */
| CONFIG_DIR_GEO_DB
{
#ifdef WITH_GEOIP
#if defined(WITH_GEOIP) or defined(WITH_MAXMIND)
std::string err;
std::string file = modsecurity::utils::find_resource($1,
driver.ref.back(), &err);
Expand All @@ -1575,7 +1575,7 @@ expression:
}
#else
std::stringstream ss;
ss << "This version of ModSecurity was not compiled with GeoIP support.";
ss << "This version of ModSecurity was not compiled with GeoIP or MaxMind support.";
driver.error(@0, ss.str());
YYERROR;
#endif // WITH_GEOIP
Expand Down