diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-04 15:59:11 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-04 15:59:11 +0000 |
commit | 0641430401984c4c56ec2e00c4b577f54cc20fb5 (patch) | |
tree | f103af70106103e559971f7644b41fe66f6493d2 /src/users.cpp | |
parent | 7395ae9a1b14359190338dff9955c0268e0fe3fd (diff) |
Better detection for hosts starting with :
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4711 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/users.cpp b/src/users.cpp index 0e29519d5..3a7eca81f 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -178,7 +178,11 @@ void UserResolver::OnLookupComplete(const std::string &result) std::string hostname = this->bound_user->stored_host; if (hostname.length() < 65) { - WriteServ(this->bound_fd, "NOTICE Auth :*** Found your hostname (%s)", this->bound_user->stored_host.c_str()); + /* Hostnames starting with : are not a good thing (tm) */ + if (*(hostname.c_str()) == ':') + hostname = "0" + hostname; + + WriteServ(this->bound_fd, "NOTICE Auth :*** Found your hostname (%s)", hostname.c_str()); this->bound_user->dns_done = true; strlcpy(this->bound_user->dhost, hostname.c_str(),64); strlcpy(this->bound_user->host, hostname.c_str(),64); @@ -814,11 +818,6 @@ void AddClient(int socket, int port, bool iscached, insp_inaddr ip) _new->fd = socket; strlcpy(_new->nick,tempnick.c_str(),NICKMAX-1); - /* Smarter than your average bear^H^H^H^Hset of strlcpys. */ - for (const char* temp = ipaddr; *temp && j < 64; temp++, j++) - _new->dhost[j] = _new->host[j] = *temp; - _new->dhost[j] = _new->host[j] = 0; - _new->server = FindServerNamePtr(Config->ServerName); /* We don't need range checking here, we KNOW 'unknown\0' will fit into the ident field. */ strcpy(_new->ident, "unknown"); @@ -831,6 +830,11 @@ void AddClient(int socket, int port, bool iscached, insp_inaddr ip) _new->SetSockAddr(AF_FAMILY, ipaddr, port); log(DEBUG,"Socket addresses set."); + /* Smarter than your average bear^H^H^H^Hset of strlcpys. */ + for (const char* temp = _new->GetIPString(); *temp && j < 64; temp++, j++) + _new->dhost[j] = _new->host[j] = *temp; + _new->dhost[j] = _new->host[j] = 0; + // set the registration timeout for this user unsigned long class_regtimeout = 90; int class_flood = 0; |