ircd: check_server: don't allow a connection if that would exceed the class limit

This commit is contained in:
Simon Arlott 2017-07-23 15:34:29 +01:00
parent e3cea4d811
commit d2b3a2a474
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24
2 changed files with 14 additions and 0 deletions

View file

@ -437,6 +437,11 @@ check_server(const char *name, struct Client *client_p)
return -5; return -5;
} }
if (client_p->localClient->att_sconf && client_p->localClient->att_sconf->class == server_p->class) {
/* this is an outgoing connection that is already attached to the correct class */
} else if (CurrUsers(server_p->class) >= MaxUsers(server_p->class)) {
return -7;
}
attach_server_conf(client_p, server_p); attach_server_conf(client_p, server_p);
/* clear ZIP/TB if they support but we dont want them */ /* clear ZIP/TB if they support but we dont want them */

View file

@ -208,6 +208,15 @@ mr_server(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *sourc
exit_client(client_p, client_p, client_p, "Invalid certificate."); exit_client(client_p, client_p, client_p, "Invalid certificate.");
} }
return;
case -7:
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Connection from servername %s rejected, no more connections allowed in class",
name);
ilog(L_SERVER, "Access denied, no more connections allowed in class for %s",
log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Access denied, no more connections allowed in class");
return; return;
default: default:
sendto_realops_snomask(SNO_GENERAL, L_ALL, sendto_realops_snomask(SNO_GENERAL, L_ALL,