diff --git a/include/h.h b/include/h.h index 74ad405f9..9883ebc7c 100644 --- a/include/h.h +++ b/include/h.h @@ -807,7 +807,7 @@ extern int process_packet(Client *cptr, char *readbuf, int length, int killsafel extern void sendto_realops_and_log(FORMAT_STRING(const char *fmt), ...) __attribute__((format(printf,1,2))); extern int parse_chanmode(ParseMode *pm, char *modebuf_in, char *parabuf_in); extern void config_report_ssl_error(void); -extern int dead_link(Client *to, char *notice); +extern int dead_socket(Client *to, char *notice); extern Match *unreal_create_match(MatchType type, char *str, char **error); extern void unreal_delete_match(Match *m); extern int unreal_match(Match *m, char *str); diff --git a/include/struct.h b/include/struct.h index 6e726482d..e8fc5cca5 100644 --- a/include/struct.h +++ b/include/struct.h @@ -1159,7 +1159,7 @@ struct LocalClient { #ifdef DEBUGMODE time_t cputime; /**< Something with debugging (why is this a time_t? TODO) */ #endif - char *error_str; /**< Quit reason set by dead_link() in case of socket/buffer error, later used by exit_client() */ + char *error_str; /**< Quit reason set by dead_socket() in case of socket/buffer error, later used by exit_client() */ char sasl_agent[NICKLEN + 1]; /**< SASL: SASL Agent the user is interacting with */ unsigned char sasl_out; /**< SASL: Number of outgoing sasl messages */ unsigned char sasl_complete; /**< SASL: >0 if SASL authentication was successful */ diff --git a/src/bsd.c b/src/bsd.c index 2cd01f3e4..bff907f59 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -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; } diff --git a/src/modules/tls_antidos.c b/src/modules/tls_antidos.c index 3d2c0b6ba..66beaa772 100644 --- a/src/modules/tls_antidos.c +++ b/src/modules/tls_antidos.c @@ -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"); } } } diff --git a/src/modules/webredir.c b/src/modules/webredir.c index c1433b58b..3cfadf828 100644 --- a/src/modules/webredir.c +++ b/src/modules/webredir.c @@ -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"); } diff --git a/src/modules/websocket.c b/src/modules/websocket.c index b8782fb5d..6b60ab64f 100644 --- a/src/modules/websocket.c +++ b/src/modules/websocket.c @@ -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; } diff --git a/src/send.c b/src/send.c index 4db1fe438..2b9bd66df 100644 --- a/src/send.c +++ b/src/send.c @@ -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:"", 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; }