diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-07 19:46:05 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-02-07 19:46:05 +0000 |
commit | 24a6c24858d4ae3e747884f6486796d161d6c301 (patch) | |
tree | e944018f2efe7fef51c96126be5666b0fa0c8c35 /src | |
parent | b8af948ecd74a924d5d490aedbb35d49c1b242cd (diff) |
Fix ipv6 ass-u-me's
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6540 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 17 | ||||
-rw-r--r-- | src/modules/m_cgiirc.cpp | 4 |
2 files changed, 17 insertions, 4 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) { diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index f7d14ecc7..beed70424 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -237,7 +237,7 @@ public: bool valid = false; #ifdef IPV6 if (strchr(user->password,':')) - valid = (inet_pton(user->password, &((sockaddr_in6*)&user->ip)->sin6_addr) > 0); + valid = (inet_pton(AF_INET6, user->password, &((sockaddr_in6*)&user->ip)->sin6_addr) > 0); else valid = (inet_aton(user->password, &((sockaddr_in*)&user->ip)->sin_addr)); #else @@ -301,7 +301,7 @@ public: user->Extend("cgiirc_realip", new std::string(user->GetIPString())); #ifdef IPV6 if (strchr(user->password,':')) - inet_pton(newip, &((sockaddr_in6*)&user->ip)->sin6_addr); + inet_pton(AF_INET6, newip, &((sockaddr_in6*)&user->ip)->sin6_addr); else inet_aton(newip, &((sockaddr_in*)&user->ip)->sin_addr); #else |