diff options
| author | 2010-09-03 23:05:21 -0400 | |
|---|---|---|
| committer | 2010-09-03 23:05:21 -0400 | |
| commit | f1bd70418237c8335bc0becc1d2543a5ce5e4ac2 (patch) | |
| tree | f7b871aa4e90abd1cc5ea7a11ed69b86c0e56280 /src/modules/m_cgiirc.cpp | |
| parent | Fix the stupid untested off-by-two ident length check (diff) | |
| download | inspircd++-f1bd70418237c8335bc0becc1d2543a5ce5e4ac2.tar.gz inspircd++-f1bd70418237c8335bc0becc1d2543a5ce5e4ac2.tar.bz2 inspircd++-f1bd70418237c8335bc0becc1d2543a5ce5e4ac2.zip | |
Fix resolved hostname being cropped when WEBIRC passes a hostname longer than 64 characters
Diffstat (limited to 'src/modules/m_cgiirc.cpp')
| -rw-r--r-- | src/modules/m_cgiirc.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/modules/m_cgiirc.cpp b/src/modules/m_cgiirc.cpp index b9f2fbf05..8aaee579f 100644 --- a/src/modules/m_cgiirc.cpp +++ b/src/modules/m_cgiirc.cpp @@ -305,20 +305,23 @@ public: virtual void OnUserConnect(User* user) { std::string *webirc_hostname, *webirc_ip; - if(user->GetExt("cgiirc_webirc_hostname", webirc_hostname)) - { - user->host.assign(*webirc_hostname, 0, 64); - user->dhost.assign(*webirc_hostname, 0, 64); - delete webirc_hostname; - user->InvalidateCache(); - user->Shrink("cgiirc_webirc_hostname"); - } if(user->GetExt("cgiirc_webirc_ip", webirc_ip)) { ServerInstance->Users->RemoveCloneCounts(user); user->SetSockAddr(user->GetProtocolFamily(), webirc_ip->c_str(), user->GetPort()); delete webirc_ip; user->InvalidateCache(); + if(user->GetExt("cgiirc_webirc_hostname", webirc_hostname) && webirc_hostname->length() < 64) + { + user->host = *webirc_hostname; + user->dhost = *webirc_hostname; + delete webirc_hostname; + } + else + { + user->host = user->dhost = user->GetIPString(); + } + user->Shrink("cgiirc_webirc_hostname"); user->Shrink("cgiirc_webirc_ip"); ServerInstance->Users->AddLocalClone(user); ServerInstance->Users->AddGlobalClone(user); |
