1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-05 15:53:13 +02:00

dead_link() -> dead_socket() since that is more descriptive

This commit is contained in:
Bram Matthys
2019-10-04 11:36:34 +02:00
parent cbe20e1d5a
commit 9e4dbf8c89
7 changed files with 24 additions and 24 deletions
+4 -4
View File
@@ -563,7 +563,7 @@ void reject_insecure_server(Client *cptr)
"If you insist with insecure linking then you can set link::options::outgoing::insecure "
"(NOT recommended!).",
cptr->name);
dead_link(cptr, "Rejected link without SSL/TLS");
dead_socket(cptr, "Rejected link without SSL/TLS");
}
void start_server_handshake(Client *cptr)
@@ -1112,7 +1112,7 @@ static void parse_client_queued(Client *cptr)
* @param readbuf The read buffer
* @param length The length of the data
* @param killsafely If 1 then we may call exit_client() if the client
* is flooding. If 0 then we use dead_link().
* is flooding. If 0 then we use dead_socket().
* @returns 1 in normal circumstances, 0 if client was killed.
* @notes If killsafely is 1 and the return value is 0 then
* you may not touch 'cptr' after calling this function
@@ -1138,7 +1138,7 @@ int process_packet(Client *cptr, char *readbuf, int length, int killsafely)
if (!killsafely)
ban_flooder(cptr);
else
dead_link(cptr, "Flood from unknown connection");
dead_socket(cptr, "Flood from unknown connection");
return 0;
}
@@ -1154,7 +1154,7 @@ int process_packet(Client *cptr, char *readbuf, int length, int killsafely)
if (!killsafely)
exit_client(cptr, NULL, "Excess Flood");
else
dead_link(cptr, "Excess Flood");
dead_socket(cptr, "Excess Flood");
return 0;
}
+1 -1
View File
@@ -83,7 +83,7 @@ void ssl_info_callback(const SSL *ssl, int where, int ret)
{
ircd_log(LOG_ERROR, "TLS Handshake flood detected from %s -- killed", get_client_name(acptr, TRUE));
sendto_realops("TLS Handshake flood detected from %s -- killed", get_client_name(acptr, TRUE));
dead_link(acptr, "TLS Handshake flood detected");
dead_socket(acptr, "TLS Handshake flood detected");
}
}
}
+1 -1
View File
@@ -197,5 +197,5 @@ CMD_FUNC(webredir)
sendto_one(sptr, NULL, "HTTP/1.1 301 Moved Permanently");
sendto_one(sptr, NULL, "Location: %s\r\n\r\n", cfg.url);
dead_link(sptr, "Connection closed");
dead_socket(sptr, "Connection closed");
}
+11 -11
View File
@@ -263,7 +263,7 @@ int websocket_handle_websocket(Client *sptr, char *readbuf2, int length2)
length = length1 + length2;
if (length > sizeof(readbuf)-1)
{
dead_link(sptr, "Illegal buffer stacking/Excess flood");
dead_socket(sptr, "Illegal buffer stacking/Excess flood");
return 0;
}
@@ -483,7 +483,7 @@ int websocket_handle_handshake(Client *sptr, char *readbuf, int *length)
n = maxcopy;
if (n <= 0)
{
dead_link(sptr, "Oversized line");
dead_socket(sptr, "Oversized line");
return -1;
}
memcpy(netbuf+nprefix, readbuf, n); /* SAFE: see checking above */
@@ -500,7 +500,7 @@ int websocket_handle_handshake(Client *sptr, char *readbuf, int *length)
if (strchr(value, ':'))
{
/* This would cause unserialization issues. Should be base64 anyway */
dead_link(sptr, "Invalid characters in Sec-WebSocket-Key");
dead_socket(sptr, "Invalid characters in Sec-WebSocket-Key");
return -1;
}
safe_strdup(WSU(sptr)->handshake_key, value);
@@ -516,7 +516,7 @@ int websocket_handle_handshake(Client *sptr, char *readbuf, int *length)
char *parx[2] = { NULL, NULL };
do_cmd(sptr, NULL, "GET", 1, parx);
}
dead_link(sptr, "Invalid WebSocket request");
dead_socket(sptr, "Invalid WebSocket request");
return -1;
}
websocket_complete_handshake(sptr);
@@ -620,13 +620,13 @@ int websocket_handle_packet(Client *sptr, char *readbuf, int length)
if (!masked)
{
dead_link(sptr, "WebSocket packet not masked");
dead_socket(sptr, "WebSocket packet not masked");
return -1; /* Having the masked bit set is required (RFC6455 p29) */
}
if (len == 127)
{
dead_link(sptr, "WebSocket packet with insane size");
dead_socket(sptr, "WebSocket packet with insane size");
return -1; /* Packets requiring 64bit lengths are not supported. Would be insane. */
}
@@ -646,7 +646,7 @@ int websocket_handle_packet(Client *sptr, char *readbuf, int length)
len = (readbuf[2] << 8) + readbuf[3];
if (len < 126)
{
dead_link(sptr, "WebSocket protocol violation (extended payload length too short)");
dead_socket(sptr, "WebSocket protocol violation (extended payload length too short)");
return -1; /* This is a violation (not a short read), see page 29 */
}
p += 2; /* advance pointer 2 bytes */
@@ -691,7 +691,7 @@ int websocket_handle_packet(Client *sptr, char *readbuf, int length)
return total_packet_size;
case WSOP_CLOSE:
dead_link(sptr, "Connection closed"); /* TODO: Improve I guess */
dead_socket(sptr, "Connection closed"); /* TODO: Improve I guess */
return -1;
case WSOP_PING:
@@ -705,7 +705,7 @@ int websocket_handle_packet(Client *sptr, char *readbuf, int length)
return total_packet_size;
default:
dead_link(sptr, "WebSocket: Unknown opcode");
dead_socket(sptr, "WebSocket: Unknown opcode");
return -1;
}
@@ -716,7 +716,7 @@ int websocket_handle_packet_ping(Client *sptr, char *buf, int len)
{
if (len > 500)
{
dead_link(sptr, "WebSocket: oversized PING request");
dead_socket(sptr, "WebSocket: oversized PING request");
return -1;
}
websocket_send_frame(sptr, WSOP_PONG, buf, len);
@@ -783,7 +783,7 @@ int websocket_send_frame(Client *sptr, int opcode, char *buf, int len)
if (DBufLength(&sptr->local->sendQ) > get_sendq(sptr))
{
dead_link(sptr, "Max SendQ exceeded");
dead_socket(sptr, "Max SendQ exceeded");
return -1;
}
+5 -5
View File
@@ -39,7 +39,7 @@ void vsendto_prefix_one(Client *to, Client *from, MessageTag *mtags,
MODVAR int current_serial;
/*
** dead_link
** dead_socket
** An error has been detected. The link *must* be closed,
** but *cannot* call ExitClient (cmd_bye) from here.
** Instead, mark it as a dead socket. This should
@@ -48,7 +48,7 @@ MODVAR int current_serial;
** notice will be the quit message. notice will also be
** sent to locally connected IRCOps in case 'to' is a server.
*/
int dead_link(Client *to, char *notice)
int dead_socket(Client *to, char *notice)
{
DBufClear(&to->local->recvQ);
DBufClear(&to->local->sendQ);
@@ -67,7 +67,7 @@ int dead_link(Client *to, char *notice)
if (!IsUser(to) && !IsUnknown(to) && !IsClosing(to))
sendto_ops_and_log("Link to server %s (%s) closed: %s",
to->name, to->ip?to->ip:"<no-ip>", notice);
Debug((DEBUG_ERROR, "dead_link: %s - %s", notice, get_client_name(to, FALSE)));
Debug((DEBUG_ERROR, "dead_socket: %s - %s", notice, get_client_name(to, FALSE)));
safe_strdup(to->local->error_str, notice);
return -1;
}
@@ -109,7 +109,7 @@ int send_queued(Client *to)
{
char buf[256];
snprintf(buf, 256, "Write error: %s", STRERROR(ERRNO));
return dead_link(to, buf);
return dead_socket(to, buf);
}
(void)dbuf_delete(&to->local->sendQ, rlen);
to->local->lastsq = DBufLength(&to->local->sendQ) / 1024;
@@ -317,7 +317,7 @@ void sendbufto_one(Client *to, char *msg, unsigned int quick)
sendto_ops("Max SendQ limit exceeded for %s: %u > %d",
get_client_name(to, FALSE), DBufLength(&to->local->sendQ),
get_sendq(to));
dead_link(to, "Max SendQ exceeded");
dead_socket(to, "Max SendQ exceeded");
return;
}