Hi,
First and foremost, I am not proficient with C. The below patch addresses the
forceful disconnect of clients who may paste or compose more data than
COMMAND_LEN in ngircd-21.1. RFC 2812 states "IRC messages are always lines of
characters terminated with a CR-LF (Carriage Return - Line Feed) pair, and
these messages SHALL NOT exceed 512 characters in length, counting all
characters including the trailing CR-LF."
The below trivial patch avoids client termination. ngricd will already
truncate messages at COMMAND_LEN and insert [CUT] into them indicating they
have been truncated by the daemon.
This patch eliminates some client frustrations when running an RFC-compliant
IRCd. I appreciate the insight and wisdom of others regarding this patch. If
I unleashed the kracken with this horrible patch I apologize in advance, it's
highly likely I've done something wrong with the below :)
Cheers,
Nathan Fowler
--- ./src/ngircd/conn.c 2014-03-18 20:36:34.000000000 -0500
+++ ./src/ngircd/conn.c 2014-04-14 13:33:10.000000000 -0500
@@ -1948,8 +1948,17 @@
"Request too long (connection %d): %d bytes (max.
%d expected)!",
Idx, array_bytes(&My_Connections[Idx].rbuf),
COMMAND_LEN - 1);
- Conn_Close(Idx, NULL, "Request too long", true);
- return 0;
+ /* Conn_Close(Idx, NULL, "Request too long", true); */
+ Conn_WriteStr( Idx,
+ ":%s NOTICE %s :%sRequest too long, %d bytes
(max. %d expected)!",
+ Client_ID(Client_ThisServer()), Client_ID(c),
+ NOTICE_TXTPREFIX,
+ array_bytes(&My_Connections[Idx].rbuf),
+ COMMAND_LEN - 1);
+
+ array_trunc(&My_Connections[Idx].rbuf);
+
+ /* return 0; */
}
len_processed += (unsigned int)len;