Ejemplo n.º 1
0
	ModResult OnCheckReady(LocalUser* user)
	{
		if (ext.get(user))
		{
			if (!declined.empty())
			{
				ServerInstance->Users->QuitUser(user, declined);
			}
			if (ext.get(user) != 3)
			{
				ext.set(user, 3);
				ServerInstance->SNO->WriteGlobalSno('p', "Suspicious connection on port %d (class %s) from %s (%s) was blocked by m_requirectcp", user->GetServerPort(), user->MyClass->name.c_str(), user->GetFullRealHost().c_str(), user->GetIPString());
			}
			return MOD_RES_DENY;
		}
		return MOD_RES_PASSTHRU;
	}
Ejemplo n.º 2
0
void ModuleDelayJoin::OnBuildNeighborList(User* source, IncludeChanList& include, std::map<User*, bool>& exception)
{
	for (IncludeChanList::iterator i = include.begin(); i != include.end(); )
	{
		Membership* memb = *i;
		if (unjoined.get(memb))
			i = include.erase(i);
		else
			++i;
	}
}
Ejemplo n.º 3
0
ModResult ModuleDelayJoin::OnNamesListItem(User* issuer, Membership* memb, std::string& prefixes, std::string& nick)
{
	/* don't prevent the user from seeing themself */
	if (issuer == memb->user)
		return MOD_RES_PASSTHRU;

	/* If the user is hidden by delayed join, hide them from the NAMES list */
	if (unjoined.get(memb))
		return MOD_RES_DENY;

	return MOD_RES_PASSTHRU;
}
Ejemplo n.º 4
0
	ModResult OnCheckReady(LocalUser* user)
	{
		switch (pendingExt.get(user))
		{
			case AUTH_STATE_NONE:
				return MOD_RES_PASSTHRU;
			case AUTH_STATE_BUSY:
				return MOD_RES_DENY;
			case AUTH_STATE_FAIL:
				ServerInstance->Users->QuitUser(user, killreason);
				return MOD_RES_DENY;
		}
		return MOD_RES_PASSTHRU;
	}
Ejemplo n.º 5
0
	ModResult OnUserRegister(LocalUser* user)
	{
		// Note this is their initial (unresolved) connect block
		ConfigTag* tag = user->MyClass->config;
		if (!tag->getBool("usesqlauth", true))
			return MOD_RES_PASSTHRU;

		if (!allowpattern.empty() && InspIRCd::Match(user->nick,allowpattern))
			return MOD_RES_PASSTHRU;

		if (pendingExt.get(user))
			return MOD_RES_PASSTHRU;

		if (!SQL)
		{
			ServerInstance->SNO->WriteGlobalSno('a', "Forbiding connection from %s (SQL database not present)", user->GetFullRealHost().c_str());
			ServerInstance->Users->QuitUser(user, killreason);
			return MOD_RES_PASSTHRU;
		}

		pendingExt.set(user, AUTH_STATE_BUSY);

		ParamM userinfo;
		SQL->PopulateUserInfo(user, userinfo);
		userinfo["pass"] = user->password;

		HashProvider* md5 = ServerInstance->Modules->FindDataService<HashProvider>("hash/md5");
		if (md5)
			userinfo["md5pass"] = md5->hexsum(user->password);

		HashProvider* sha256 = ServerInstance->Modules->FindDataService<HashProvider>("hash/sha256");
		if (sha256)
			userinfo["sha256pass"] = sha256->hexsum(user->password);

		AuthQuery* authQuery = NULL;
		if (usebcrypt)
		{
			authQuery = new BCryptAuthQuery(this, user->uuid, user->password, pendingExt, verbose);
		}
		else
		{
			authQuery = new AuthQuery(this, user->uuid, pendingExt, verbose);
		}

		SQL->submit(authQuery, freeformquery, userinfo);

		return MOD_RES_PASSTHRU;
	}
Ejemplo n.º 6
0
	ModResult OnPreCommand(std::string &command, std::vector<std::string> &parameters, LocalUser* user, bool validated, const std::string &original_line)
	{
		if (command == "NOTICE" && !validated && parameters.size() > 1 && ext.get(user))
		{
			if (parameters[1].size() > 1 && parameters[1][0] == 0x1 && parameters[1].compare(1, ctcp.length(), ctcp) == 0)
			{
				ext.set(user, 0);
				if (!accepted.empty())
				{
					user->WriteServ("NOTICE " + user->nick + " :*** " + accepted);
				}
				return MOD_RES_DENY;
			}
		}
		return MOD_RES_PASSTHRU;
	}