mr_server: Handle unknown error codes

As mr_server is a module, it could potentially receive an unknown
error code from check_server().
This commit is contained in:
Simon Arlott 2016-04-23 17:30:59 +01:00 committed by Keith Buck
parent 0264fe161f
commit 8d0153ff55

View file

@ -77,6 +77,7 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
int hop;
unsigned int required_mask;
const char *missing;
int ret;
name = parv[1];
hop = atoi(parv[2]);
@ -112,8 +113,12 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
/* Now we just have to call check_server and everything should be
* check for us... -A1kmm. */
switch (check_server(name, client_p))
ret = check_server(name, client_p);
switch (ret)
{
case 0:
/* success */
break;
case -1:
if(ConfigFileEntry.warn_no_nline)
{
@ -183,6 +188,16 @@ mr_server(struct Client *client_p, struct Client *source_p, int parc, const char
exit_client(client_p, client_p, client_p, "Access denied, requires SSL/TLS but is plaintext");
return 0;
default:
sendto_realops_snomask(SNO_GENERAL, L_ALL,
"Connection from servername %s rejected, unknown error %d",
name, ret);
ilog(L_SERVER, "Access denied, unknown error %d for server %s%s", ret,
EmptyString(client_p->name) ? name : "",
log_client_name(client_p, SHOW_IP));
exit_client(client_p, client_p, client_p, "Unknown error.");
return 0;
}
/* require TS6 for direct links */