summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-08 04:03:13 +0000
committerspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-08 04:03:13 +0000
commit53d548355b6657e01bd6a296dc87c4abec271fef (patch)
tree2fa5eaca2dfa06bd221ca408958175fcaec61f1e /src
parent55107487aa7f4fae3552371d80c8bfe1584db0a3 (diff)
Patch by satmd to support using IP addresses with cgiirc
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6634 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_cgiirc.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp
index f7dd03d8d..96ac66f14 100644
--- a/src/modules/m_cgiirc.cpp
+++ b/src/modules/m_cgiirc.cpp
@@ -26,6 +26,7 @@
enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST, WEBIRC };
+
/** Holds a CGI site's details
*/
class CGIhost : public classbase
@@ -67,8 +68,9 @@ class cmd_webirc : public command_t
user->Extend("cgiirc_realhost", new std::string(user->host));
user->Extend("cgiirc_realip", new std::string(user->GetIPString()));
if (notify)
- ServerInstance->WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick, user->host, parameters[2], "_");
+ ServerInstance->WriteOpers("*** Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", user->nick, user->host, parameters[2], user->host);
user->Extend("cgiirc_webirc_hostname", new std::string(parameters[2]));
+ user->Extend("cgiirc_webirc_ip", new std::string(parameters[3]));
return CMD_LOCALONLY;
}
}
@@ -276,15 +278,32 @@ public:
virtual void OnUserConnect(userrec* user)
{
- std::string* webirc_hostname;
+ std::string *webirc_hostname, *webirc_ip;
if(user->GetExt("cgiirc_webirc_hostname", webirc_hostname))
{
strlcpy(user->host,webirc_hostname->c_str(),63);
strlcpy(user->dhost,webirc_hostname->c_str(),63);
- user->InvalidateCache();
delete webirc_hostname;
+ user->InvalidateCache();
user->Shrink("cgiirc_webirc_hostname");
}
+ if(user->GetExt("cgiirc_webirc_ip", webirc_ip))
+ {
+ bool valid=false;
+#ifdef IPV6
+ valid = (inet_pton(AF_INET6, webirc_ip->c_str(), &((sockaddr_in6*)user->ip)->sin6_addr) > 0);
+
+ if(!valid)
+ valid = (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr));
+#else
+ if (inet_aton(webirc_ip->c_str(), &((sockaddr_in*)user->ip)->sin_addr))
+ valid = true;
+#endif
+
+ delete webirc_ip;
+ user->InvalidateCache();
+ user->Shrink("cgiirc_webirc_ip");
+ }
}
bool CheckPass(userrec* user)