diff options
Diffstat (limited to 'src/modules/extra')
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index 76259a35b..00be6ec26 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -803,7 +803,6 @@ class ModulePgSQL : public Module { SQLhost host; int ipvalid; - insp_inaddr blargle; host.id = conf.ReadValue("database", "id", i); host.host = conf.ReadValue("database", "hostname", i); @@ -816,7 +815,21 @@ class ModulePgSQL : public Module if (HasHost(host)) continue; - ipvalid = insp_aton(host.host.c_str(), &blargle); +#ifdef IPV6 + if (strchr(host.host.c_str(),':')) + { + in6_addr blargle; + ipvalid = inet_pton(AF_INET6, host.host.c_str(), &blargle); + } + else + { + in_addr blargle; + ipvalid = inet_aton(host.host.c_str(), &blargle); + } +#else + in_addr blargle; + ipvalid = inet_aton(host.host.c_str(), &blargle); +#endif if(ipvalid > 0) { |