/* $ModDesc: Change user's hosts connecting from known CGI:IRC hosts */
-enum CGItype { PASS, IDENT, PASSFIRST, IDENTFIRST, WEBIRC };
+enum CGItype { INVALID, PASS, IDENT, PASSFIRST, IDENTFIRST, WEBIRC };
/** Holds a CGI site's details
CGIResolver(Module* me, InspIRCd* ServerInstance, bool NotifyOpers, const std::string &source, bool forward, userrec* u, int userfd, const std::string &type, bool &cached)
: Resolver(ServerInstance, source, forward ? DNS_QUERY_A : DNS_QUERY_PTR4, cached, me), typ(type), theirfd(userfd), them(u), notify(NotifyOpers) { }
- virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached)
+ virtual void OnLookupComplete(const std::string &result, unsigned int ttl, bool cached, int resultnum = 0)
{
+ if (resultnum)
+ return;
+
/* Check the user still exists */
if ((them) && (them == ServerInstance->SE->GetRef(theirfd)))
{
if(hostmask.length())
{
- if(type == "webirc" && !password.length()) {
+ if (type == "webirc" && !password.length()) {
ServerInstance->Log(DEFAULT, "m_cgiirc: Missing password in config: %s", hostmask.c_str());
- } else {
- CGItype cgitype;
- if(type == "pass")
+ }
+ else
+ {
+ CGItype cgitype = INVALID;
+ if (type == "pass")
cgitype = PASS;
- else if(type == "ident")
+ else if (type == "ident")
cgitype = IDENT;
- else if(type == "passfirst")
+ else if (type == "passfirst")
cgitype = PASSFIRST;
- else if(type == "webirc") {
+ else if (type == "webirc")
+ {
cgitype = WEBIRC;
}
+
+ if (cgitype == INVALID)
+ cgitype = PASS;
+
Hosts.push_back(CGIhost(hostmask,cgitype, password.length() ? password : "" ));
}
}