X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/155f84c1a708b051fafd86503e510ceb4be1ec82..c3312d9a8774a039092ff613d18f8e2fef1b4e4a:/trusts/trusts_policy.c diff --git a/trusts/trusts_policy.c b/trusts/trusts_policy.c index 607fa97f..32a8ca51 100644 --- a/trusts/trusts_policy.c +++ b/trusts/trusts_policy.c @@ -1,14 +1,27 @@ #include "../core/hooks.h" #include "../control/control.h" +#include "../lib/irc_string.h" #include "trusts.h" static int countext; static void policycheck(int hooknum, void *arg) { - nick *np = arg; + void **args = arg; + nick *np = args[0]; + long moving = (long)args[1]; trusthost *th = gettrusthost(np); - trustgroup *tg = th->group; + trustgroup *tg; + if(moving) + return; + + if(!th) { + if(np->ipnode->usercount > 5) + controlwall(NO_OPER, NL_TRUSTS, "Hard connection limit exceeded on IP: %s (untrusted) %d connected, 5 max.", IPtostr(np->p_ipaddr), np->ipnode->usercount); + return; + } + + tg = th->group; /* * the purpose of this logic is to avoid spam like this: * WARNING: tgX exceeded limit: 11 connected vs 10 max @@ -17,12 +30,34 @@ static void policycheck(int hooknum, void *arg) { */ if(hooknum == HOOK_TRUSTS_NEWNICK) { - if(tg->count > tg->maxusage) { + if(tg->count > tg->trustedfor) { +/* if(tg->count > (long)tg->exts[countext]) { + tg->exts[countext] = (void *)(long)tg->count; +*/ + controlwall(NO_OPER, NL_TRUSTS, "Hard connection limit exceeded: '%s', %d connected, %d max.", tg->name->content, tg->count, tg->trustedfor); + } +/* + } +*/ + if((tg->mode == 1) && (np->ident[0] == '~')) + controlwall(NO_OPER, NL_TRUSTS, "Ident required: '%s' %s!%s@%s.", tg->name->content, np->nick, np->ident, np->host->name->content); - controlwall(NO_OPER, NL_TRUSTS, "Hard limit exceeded: '%s', %d connected, %d max.", tg->name->content, tg->count, tg->maxusage); + if(tg->maxperident > 0) { + int identcount = 0; + trusthost *th2; + nick *tnp; + + for(th2=tg->hosts;th2;th2=th2->next) { + for(tnp=th2->users;tnp;tnp=nextbytrust(tnp)) { + if(!ircd_strcmp(tnp->ident, np->ident)) + identcount++; + } } + + if(identcount > tg->maxperident) + controlwall(NO_OPER, NL_TRUSTS, "Hard ident limit exceeded: '%s' %s!%s@%s, %d connected, %d max.", tg->name->content, np->nick, np->ident, np->host->name->content, identcount, tg->maxperident); } } else { if(tg->count < tg->maxusage)