/* OKAY! Lots of checking here!
*
* Need to check:
- * - host isn't already covered by given group (reject if it is)
+ * - exact same host isn't already covered by given group (reject if it is)
* - host doesn't already exist exactly already (reject if it does)
* - host is more specific than an existing one (warn if it is, fix up later)
* - host is less specific than an existing one (warn if it is, don't need to do anything special)
*/
for(th=tg->hosts;th;th=th->next) {
- if(ipmask_check(&ip, &th->ip, th->bits)) {
+ if(ipmask_check(&ip, &th->ip, th->bits) && th->bits == bits) {
controlreply(sender, "This host (or part of it) is already covered in the given group.");
return CMD_ERROR;
}
controlwall(NO_OPER, NL_TRUSTS, "%s TRUSTGROUPADD'ed '%s'", controlid(sender), tg->name->content);
trustlog(tg, sender->authname, "Created trust group '%s' (ID #%d): howmany=%d, enforceident=%d, maxperident=%d, "
"createdby=%s, contact=%s, comment=%s",
- tg->name->content, howmany, tg->id, enforceident, maxperident, createdby, contact, comment);
+ tg->name->content, tg->id, howmany, enforceident, maxperident, createdby, contact, comment);
return CMD_OK;
}
trusthost *th;
int thcount = 0, tgcount = 0;
int i;
+ flag_t noticelevel;
array expiredths, expiredtgs;
now = getnettime();
to_age = now - (CLEANUP_TH_INACTIVE * 3600 * 24);
if(np) {
- controlwall(NO_OPER, NL_TRUSTS, "CLEANUPTRUSTS: Manually started by %s.", np->nick);
+ noticelevel = NL_TRUSTS;
+ controlwall(NO_OPER, noticelevel, "CLEANUPTRUSTS: Manually started by %s.", np->nick);
} else {
- controlwall(NO_OPER, NL_TRUSTS, "CLEANUPTRUSTS: Automatically started.");
+ noticelevel = NL_CLEANUP;
+ controlwall(NO_OPER, noticelevel, "CLEANUPTRUSTS: Automatically started.");
}
if (cleanuptrusts_active) {
tgcount++;
}
- controlwall(NO_OPER, NL_TRUSTS, "CLEANUPTRUSTS: Removed %d trust hosts (inactive for %d days) and %d empty trust groups.", thcount, CLEANUP_TH_INACTIVE, tgcount);
+ controlwall(NO_OPER, noticelevel, "CLEANUPTRUSTS: Removed %d trust hosts (inactive for %d days) and %d empty trust groups.", thcount, CLEANUP_TH_INACTIVE, tgcount);
cleanuptrusts_active=0;
}