Example #1
0
static void
os_akill_newuser(hook_user_nick_t *data)
{
	struct user *u = data->u;
	struct kline *k;

	// If the user has been killed, don't do anything.
	if (!u)
		return;

	if (is_internal_client(u))
		return;
	k = kline_find_user(u);
	if (k != NULL)
	{
		/* Server didn't have that kline, send it again.
		 * To ensure kline exempt works on akills too, do
		 * not send a KILL. -- jilles */
		char reason[BUFSIZE];
		snprintf(reason, sizeof(reason), "[#%lu] %s", k->number, k->reason);
		if (! (u->flags & UF_KLINESENT)) {
			kline_sts("*", k->user, k->host, k->duration ? k->expires - CURRTIME : 0, reason);
			u->flags |= UF_KLINESENT;
		}
	}
}
static void
aknl_nickhook(hook_user_nick_t *data)
{
	user_t *u;
	bool doit = false;
	const char *username;

	return_if_fail(data != NULL);

	if (!data->u)
		return;

	u = data->u;

	if (is_internal_client(u))
		return;

	if (is_autokline_exempt(u))
		return;

	username = u->user;
	if (*username == '~')
		username++;

	if (mowgli_patricia_retrieve(akillalllist, u->nick) != NULL && 
	    mowgli_patricia_retrieve(akillalllist, username) != NULL &&
	    mowgli_patricia_retrieve(akillalllist, u->gecos) != NULL)
		doit = true;

	if (mowgli_patricia_retrieve(akillnicklist, u->nick) != NULL)
		doit = true;

	if (mowgli_patricia_retrieve(akilluserlist, username) != NULL)
		doit = true;

	if (mowgli_patricia_retrieve(akillreallist, u->gecos) != NULL)
		doit = true;

	if (!doit)
		return;

	slog(LG_INFO, "AKNL: k-lining \2%s\2!%s@%s [%s] due to appearing to be a possible spambot", u->nick, u->user, u->host, u->gecos);
	kline_sts("*", "*", u->host, 86400, "Possible spambot");
}