Skip to content

Commit

Permalink
Fix resolved hostname being cropped when WEBIRC passes a hostname lon…
Browse files Browse the repository at this point in the history
…ger than 64 characters
  • Loading branch information
Daniel De Graaf committed Sep 4, 2010
1 parent e0ffef8 commit f1bd704
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/modules/m_cgiirc.cpp
Expand Up @@ -305,20 +305,23 @@ class ModuleCgiIRC : public Module
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);
Expand Down

0 comments on commit f1bd704

Please sign in to comment.