diff --git a/src/modules/antirandom.c b/src/modules/antirandom.c index e5b9761f6..f613f3e9d 100644 --- a/src/modules/antirandom.c +++ b/src/modules/antirandom.c @@ -953,24 +953,25 @@ int antirandom_preconnect(Client *client) { int score; - if (!is_exempt(client)) + if (is_exempt(client)) + return HOOK_CONTINUE; + + score = get_spam_score(client); + if (score > cfg.threshold) { - score = get_spam_score(client); - if (score > cfg.threshold) + if (cfg.ban_action == BAN_ACT_WARN) { - if (cfg.ban_action == BAN_ACT_WARN) - { - sendto_ops_and_log("[antirandom] would have denied access to user with score %d: %s!%s@%s:%s", - score, client->name, client->user->username, client->user->realhost, client->info); - return 0; - } - if (cfg.show_failedconnects) - sendto_ops_and_log("[antirandom] denied access to user with score %d: %s!%s@%s:%s", - score, client->name, client->user->username, client->user->realhost, client->info); - return place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time); + sendto_ops_and_log("[antirandom] would have denied access to user with score %d: %s!%s@%s:%s", + score, client->name, client->user->username, client->user->realhost, client->info); + return HOOK_CONTINUE; } + if (cfg.show_failedconnects) + sendto_ops_and_log("[antirandom] denied access to user with score %d: %s!%s@%s:%s", + score, client->name, client->user->username, client->user->realhost, client->info); + place_host_ban(client, cfg.ban_action, cfg.ban_reason, cfg.ban_time); + return HOOK_DENY; } - return 0; + return HOOK_CONTINUE; } static void free_stuff(void) diff --git a/src/modules/blacklist.c b/src/modules/blacklist.c index 784595399..b346e88e3 100644 --- a/src/modules/blacklist.c +++ b/src/modules/blacklist.c @@ -719,11 +719,11 @@ int blacklist_parse_reply(struct hostent *he, int entry) * from blacklist_preconnect() for softbans that need to be delayed * as to give the user the opportunity to do SASL Authentication. */ -int blacklist_action(Client *client, char *opernotice, BanAction ban_action, char *ban_reason, long ban_time) +void blacklist_action(Client *client, char *opernotice, BanAction ban_action, char *ban_reason, long ban_time) { sendto_snomask(SNO_BLACKLIST, "%s", opernotice); ircd_log(LOG_KILL, "%s", opernotice); - return place_host_ban(client, ban_action, ban_reason, ban_time); + place_host_ban(client, ban_action, ban_reason, ban_time); } void blacklist_hit(Client *client, Blacklist *bl, int reply) @@ -827,11 +827,12 @@ int blacklist_preconnect(Client *client) BLUser *blu = BLUSER(client); if (!blu || !blu->save_action) - return 0; + return HOOK_CONTINUE; /* There was a pending softban... has the user authenticated via SASL by now? */ if (IsLoggedIn(client)) - return 0; /* yup, so the softban does not apply. */ + return HOOK_CONTINUE; /* yup, so the softban does not apply. */ - return blacklist_action(client, blu->save_opernotice, blu->save_action, blu->save_reason, blu->save_tkltime); + blacklist_action(client, blu->save_opernotice, blu->save_action, blu->save_reason, blu->save_tkltime); + return HOOK_DENY; } diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index 39377e5fb..533c44971 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -384,25 +384,25 @@ int ct_pre_lconnect(Client *client) int score; if (me.local->firsttime + cfg.start_delay > TStime()) - return 0; /* no throttle: start delay */ + return HOOK_CONTINUE; /* no throttle: start delay */ if (ucounter->disabled) - return 0; /* protection disabled: allow user */ + return HOOK_CONTINUE; /* protection disabled: allow user */ if (still_reputation_gathering()) - return 0; /* still gathering reputation data */ + return HOOK_CONTINUE; /* still gathering reputation data */ if (cfg.sasl_bypass && IsLoggedIn(client)) { /* Allowed in: user authenticated using SASL */ - return 0; + return HOOK_CONTINUE; } score = GetReputation(client); if (score >= cfg.minimum_reputation_score) { /* Allowed in: IP has enough reputation ("known user") */ - return 0; + return HOOK_CONTINUE; } /* If we reach this then the user is NEW */ @@ -429,10 +429,10 @@ int ct_pre_lconnect(Client *client) ucounter->throttling_banner_displayed = 1; } exit_client(client, NULL, cfg.reason); - return -1; + return HOOK_DENY; } - return 0; + return HOOK_CONTINUE; } /** Increase the connect counter(s), nothing else. */