X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fextra%2Fm_geo_maxmind.cpp;h=b964a393ceb561f64438124149a519b3bf8f0581;hb=9982ec4e5b027ed24b1fda5e6fd3ab35b98de1a7;hp=f249ecf9154c642daf68cba679e1faa4eec26da2;hpb=87b1461e2a4710a38b32186c2582da9fe9bb3804;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/extra/m_geo_maxmind.cpp b/src/modules/extra/m_geo_maxmind.cpp index f249ecf91..b964a393c 100644 --- a/src/modules/extra/m_geo_maxmind.cpp +++ b/src/modules/extra/m_geo_maxmind.cpp @@ -19,6 +19,7 @@ /// $CompilerFlags: find_compiler_flags("libmaxminddb" "") /// $LinkerFlags: find_linker_flags("libmaxminddb" "-lmaxminddb") +/// $PackageInfo: require_system("arch") libmaxminddb pkgconf /// $PackageInfo: require_system("darwin") libmaxminddb pkg-config /// $PackageInfo: require_system("debian" "9.0") libmaxminddb-dev pkg-config /// $PackageInfo: require_system("ubuntu" "16.04") libmaxminddb-dev pkg-config @@ -27,15 +28,15 @@ # pragma comment(lib, "libmaxminddb.lib") #endif -#include #include "inspircd.h" #include "modules/geolocation.h" +#include -class GeolocationExtItem : public LocalExtItem +class GeolocationExtItem : public ExtensionItem { public: GeolocationExtItem(Module* parent) - : LocalExtItem("geolocation", ExtensionItem::EXT_USER, parent) + : ExtensionItem("geolocation", ExtensionItem::EXT_USER, parent) { } @@ -97,6 +98,10 @@ class GeolocationAPIImpl : public Geolocation::APIBase Geolocation::Location* GetLocation(irc::sockets::sockaddrs& sa) CXX11_OVERRIDE { + // Skip trying to look up a UNIX socket. + if (sa.family() != AF_INET && sa.family() != AF_INET6) + return NULL; + // Attempt to look up the socket address. int result; MMDB_lookup_result_s lookup = MMDB_lookup_sockaddr(&mmdb, &sa.sa, &result);