-/** Resolver for CGI:IRC hostnames encoded in ident/GECOS
- */
-class CGIResolver : public DNS::Request
-{
- std::string typ;
- std::string theiruid;
- LocalIntExt& waiting;
- bool notify;
- public:
- CGIResolver(DNS::Manager *mgr, Module* me, bool NotifyOpers, const std::string &source, LocalUser* u,
- const std::string &ttype, LocalIntExt& ext)
- : DNS::Request(mgr, me, source, DNS::QUERY_PTR), typ(ttype), theiruid(u->uuid),
- waiting(ext), notify(NotifyOpers)
- {
- }
-
- void OnLookupComplete(const DNS::Query *r) CXX11_OVERRIDE
- {
- /* Check the user still exists */
- User* them = ServerInstance->FindUUID(theiruid);
- if ((them) && (!them->quitting))
- {
- LocalUser* lu = IS_LOCAL(them);
- if (!lu)
- return;
-
- const DNS::ResourceRecord &ans_record = r->answers[0];
- if (ans_record.rdata.empty() || ans_record.rdata.length() > 64)
- return;
-
- if (notify)
- ServerInstance->SNO->WriteGlobalSno('a', "Connecting user %s detected as using CGI:IRC (%s), changing real host to %s from %s", them->nick.c_str(), them->host.c_str(), ans_record.rdata.c_str(), typ.c_str());
-
- them->host = them->dhost = ans_record.rdata;
- them->InvalidateCache();
- lu->CheckLines(true);