340 |
bool |
bool |
341 |
conf_check_client(struct Client *client) |
conf_check_client(struct Client *client) |
342 |
{ |
{ |
343 |
int i; |
const char *error = NULL; |
344 |
|
bool warn = true; |
345 |
|
|
346 |
if ((i = verify_access(client))) |
switch (verify_access(client)) |
|
ilog(LOG_TYPE_IRCD, "Access denied: %s[%s]", |
|
|
client->name, client->sockhost); |
|
|
|
|
|
switch (i) |
|
347 |
{ |
{ |
348 |
case TOO_MANY: |
case TOO_MANY: |
349 |
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
error = "too many connections on IP"; |
|
"Too many on IP for %s (%s).", |
|
|
client_get_name(client, SHOW_IP), |
|
|
client->sockhost); |
|
|
ilog(LOG_TYPE_IRCD, "Too many connections on IP from %s.", |
|
|
client_get_name(client, SHOW_IP)); |
|
|
++ServerStats.is_ref; |
|
|
exit_client(client, "No more connections allowed on that IP"); |
|
350 |
break; |
break; |
|
|
|
351 |
case I_LINE_FULL: |
case I_LINE_FULL: |
352 |
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
error = "connection class is full"; |
|
"auth {} block is full for %s (%s).", |
|
|
client_get_name(client, SHOW_IP), |
|
|
client->sockhost); |
|
|
ilog(LOG_TYPE_IRCD, "Too many connections from %s.", |
|
|
client_get_name(client, SHOW_IP)); |
|
|
++ServerStats.is_ref; |
|
|
exit_client(client, "No more connections allowed in your connection class"); |
|
353 |
break; |
break; |
|
|
|
354 |
case NOT_AUTHORIZED: |
case NOT_AUTHORIZED: |
355 |
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, |
error = "not authorized"; |
|
"Unauthorized client connection from %s.", |
|
|
client_get_name(client, SHOW_IP)); |
|
|
ilog(LOG_TYPE_IRCD, "Unauthorized client connection from %s.", |
|
|
client_get_name(client, SHOW_IP)); |
|
|
++ServerStats.is_ref; |
|
|
exit_client(client, "You are not authorized to use this server"); |
|
356 |
break; |
break; |
|
|
|
357 |
case BANNED_CLIENT: |
case BANNED_CLIENT: |
358 |
++ServerStats.is_ref; |
error = "banned from server"; |
359 |
exit_client(client, "Banned"); |
warn = false; |
|
break; |
|
|
|
|
|
case 0: |
|
|
default: |
|
360 |
break; |
break; |
361 |
} |
} |
362 |
|
|
363 |
if (i < 0) |
if (error) |
364 |
|
{ |
365 |
|
char buf[REASONLEN + 1]; |
366 |
|
snprintf(buf, sizeof(buf), "Connection rejected - %s", error); |
367 |
|
|
368 |
|
++ServerStats.is_ref; |
369 |
|
|
370 |
|
if (warn == true) |
371 |
|
sendto_realops_flags(UMODE_REJ, L_ALL, SEND_NOTICE, "Rejecting client connection from %s: %s", |
372 |
|
client_get_name(client, SHOW_IP), error); |
373 |
|
|
374 |
|
ilog(LOG_TYPE_IRCD, "Rejecting client connection from %s: %s", |
375 |
|
client_get_name(client, SHOW_IP), error); |
376 |
|
exit_client(client, buf); |
377 |
return false; |
return false; |
378 |
|
} |
379 |
|
|
380 |
return true; |
return true; |
381 |
} |
} |
382 |
|
|