- user->Extend("cgiirc_realhost", new std::string(user->host));
- user->Extend("cgiirc_realip", new std::string(user->GetIPString()));
- strlcpy(user->host, user->password, 64);
- strlcpy(user->dhost, user->password, 64);
- user->InvalidateCache();
-
- bool valid = false;
- ServerInstance->Users->RemoveCloneCounts(user);
-#ifdef IPV6
- if (user->GetProtocolFamily() == AF_INET6)
- 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
- if (inet_aton(user->password, &((sockaddr_in*)user->ip)->sin_addr))
- valid = true;
-#endif
- ServerInstance->Users->AddLocalClone(user);
- ServerInstance->Users->AddGlobalClone(user);
- user->CheckClass();
-
- if (valid)
- {
- /* We were given a IP in the password, we don't do DNS so they get this is as their host as well. */
- if(NotifyOpers)
- ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick, user->host, user->password);
- }
- else
- {
- /* We got as resolved hostname in the password. */
- try
- {
-
- bool cached;
- CGIResolver* r = new CGIResolver(this, ServerInstance, NotifyOpers, user->password, false, user, user->GetFd(), "PASS", cached);
- ServerInstance->AddResolver(r, cached);
- }
- catch (...)
- {
- if (NotifyOpers)
- ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), but I could not resolve their hostname!", user->nick, user->host);
- }
- }
-
- *user->password = 0;
-
- /*if(NotifyOpers)
- ServerInstance->SNO->WriteToSnoMask('A', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from PASS", user->nick, user->host, user->password);*/
-