about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)Author
2020-05-07Allow more characters per line in MOTD and help text filesAlexander Barton
Change the line buffer in the Read_TextFile() function from 127 to COMMAND_LEN (=512) bytes. Lines can't even get that long, because they have to be prefixed before being sent to the client, so this is a sane maximum. This allows for even more "fancy" and "wider" MOTDs :-) Closes #271.
2020-05-07Show allowed channel types in ISUPPORT(005) numeric onlyAlexander Barton
Don't show the static list of all possibly available channel types ... Closes #273.
2020-05-07SSL test server: Use port 6790, like "test server #2"Alexander Barton
Don't use the "standard" IRC SSL port 6697, as this easily collides with real (ng)IRCd instances running on the same machine. And by reusing port 6790, which is already used by the "test server #2", we don't need any other port than the test suite already uses.
2020-05-06Merge pull request #269 from hillu/gnutls-reload-certAlexander Barton
Add support for GnuTLS certificate reload. Thanks a lot, Hilko Bengen!
2020-05-04Update Client_SetHostname() to not use strpbrk()Alexander Barton
Not sure about the portability of strpbrk() in really ancient OS, and this was the only place where it became used recently in ngIRCd ... So let's play it safe! ;-)
2020-05-04Allow hostmask cloaking when rDNS is disabledmichi
2020-05-04Don't wait for the network when read buffers possibly hold commandsAlexander Barton
There is no point in waiting up to one second for the network receiving new data when there is still a read buffer holding at least one command; we shouldn't waste time but handle it immediately!
2020-05-04Handle commands in the read buffer before reading more dataAlexander Barton
If there are more bytes in the read buffer already than a single valid IRC command can get long (513 bytes, COMMAND_LEN), wait for this/those command(s) to be handled first and don't try to read even more data from the network (which most probably would overflow the read buffer of this connection soon).
2020-05-04Read_Request(): Clean up code and add some more commentsAlexander Barton
No functional changes.
2020-05-04Revert "Increase read buffer size for server connections"Alexander Barton
This reverts commit c6e3c13f27744971fcb1d2de4e561d3bcdaa5aed. This sounded like the right approach at first, but I'm not that sure that it really makes sense to have different sizes of read buffers: the per-connection read buffer only needs to keep data that is needed to parse one full command, be it plain text, encrypted and/or compressed. Then ngIRCd should handle this one command, move leftover data to the beginning of the buffer and read the next chunk from the network that is missing to get the next complete command (512 bytes at max). So I revert this for now and try to fix the logic in Read_Request(), which is broken nevertheless, as it results in servers becoming disconnected during "server burst" when "big" lists are transferred.
2020-05-03Correctly use Config_Error() instead of Log() in Read_Config()Alexander Barton
The name of the Config_Error() function is misleading: it is not only used to show configuraton errors, but all messages shown during normal operation as well as for "config testing": it takes care of the correct formatting of the messages (syslog, forground logging, config testing). This fixes commit bb1d014abad8.
2020-05-03Log G-/K-Line changes only when not initiated by a serverAlexander Barton
This prevents the log from becomming spammed during "net bursts".
2020-05-03Set the "last data" time to "last ping" time when updating the latterAlexander Barton
This is required because the PING can be received quite a bit earlier than it is actually handled, for example during "server burst" or other heavy operations: So the times won't match and PING-PONG logic would become garbled, because we test for "last ping > last data" to determine if a PING already was sent or not.
2020-04-25updating testsuite to support ssl-testsJohann Hartwig Hauschild
2020-04-20Remove legacy configuration optionsmichi
Remove legacy configuration options and related functions that have been marked for removal for some time: - PredefChannelsOnly (v22) - NoticeAuth (v24) - NoXXX (v19) - Old '[GLOBAL]' section handling (v19)
2020-04-20Increase read buffer size for server connectionsmichi
This applies the same logic we have for write buffers to distinguish between server and client connections and sets the maximum buffer size accordingly. As a result peering with servers with many GLINE/KLINEs does not kill the connecting server connection anymore.
2020-04-20Fix recursion bug on write errormichi
Depending on the stack size, too many clients on the same channel quitting at the same time would trigger a crash due to too many recursive calls to Conn_Close().
2020-04-20Fix hostmask cloaking bug for IPv6 toomichi
2020-04-20Unbreak GCC 10 (-fno-common) buildmichi
2020-04-19GnuTLS: Eliminate memory leaks for DH parameters, priorities cacheHilko Bengen
The DH parameters reference has to be stored next to the x509_cred which holds a reference to it.
2020-04-17Add support for GnuTLS certificate reloadHilko Bengen
This requires keeping track of currently active certificates, so those are stored separately, along with a reference counter, and discarded when they are no longer in use.
2020-03-29Add deprecation warnings for "Key" and "MaxUsers" in [Channel]Alexander Barton
2020-03-29Test suite: Test multiple "Modes" lines in [Channel] sectionsAlexander Barton
2020-03-29Predefined channles: Fix handling of legacy configuration optionsAlexander Barton
Fix the handling of legacy "Key" and "MaxUsers" [Channel] settings: - Activate them before evaluating the "Modes" parameter, to allow the latter to override those legacy options. - Enforce setting the respective +k/+l mode(s) to support the legacy "Mode = kl" notation, which was valid but is an invalid MODE string: key and limit are missing! So set them manually when "k" or "l" are detected in the first MODE parameter. - Sort modes +kl alphabetically, adjust test suite accordingly.
2020-03-29Enhance logging while setting up predefined channelsAlexander Barton
2020-03-29Allow multiple "Modes =" lines per [Channel] sectionmichi
2020-03-28Evaluate initial channel modesmichi
Allow setting arbitrary channel modes in the config file. Closes #55.
2020-03-22Add "FNC" (forced nick changes) to ISUPPORT(005) numericAlexander Barton
Most probably this doesn't make any difference to any client, but it seems correct. See <http://www.irc.org/tech_docs/005.html> for details.
2020-02-15Fix memory leak in portabtest Check_strtok_r()Alexander Barton
Fix the following Clang "LeakSanitizer" error (which isn't quite relevant in this test program, but anyway): ERROR: LeakSanitizer: detected memory leaks Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x7f8c4d022810 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x3a810) #1 0x5601a801491a in Check_strtok_r (/net/arthur/home/alex/Develop/ngIRCd/ngIRCd.git/src/portab/portabtest+0x291a) #2 0x5601a8014d77 in main (/net/arthur/home/alex/Develop/ngIRCd/ngIRCd.git/src/portab/portabtest+0x2d77) #3 0x7f8c4c69009a in __libc_start_main ../csu/libc-start.c:308 SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). FAIL: portabtest
2020-02-15Reuse old SSL key if loading a new one failedmichi
2020-01-212020!Alexander Barton
2019-12-31Enhance handling of command line errors, and "--help" & "--version"Alexander Barton
Return with exit code 0 ("no error") when "--help" or "--version" was used (this resulted in exit code 1, "error" before). And exit with code 2 ("command line error") for all invalid command line options, and show the error message on stderr (message was printed to stdout before, and exit code was 1, "generic error"). This new behaviour is more in line with the GNU "coding standards", see <https://www.gnu.org/prep/standards/html_node/_002d_002dhelp.html>.
2019-11-10Log received signals (using strsignal(3), when available)Alexander Barton
2019-11-03Make test suite compatible with HaikuAlexander Barton
2019-09-09Fix hostmask cloaking bug, don't cloak multiple timesJRMU
Previously, each server would cloak every user's hostmask. The problem is that if a network has more than one server, then a user's hostmask would get cloaked twice. This patch ensures that a server only cloaks the hostmask if it has not yet been cloaked (the period indicates it's still an IP address). Closes #228.
2019-07-21Fix some typos (documentation files, ngircd.conf manual page, ...)Alexander Barton
Spotted by Étienne Mollier <etienne.mollier@mailoo.org> and Christoph Biedl <debian.axhn@manchmal.in-ulm.de>, see Debian bug #932462 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932462). Thank you!
2019-06-29Enlage buffers of info texts to 128 bytes.Alexander Barton
This includes: - "Real name" of a client (4th filed of the USER command). - Server info text ("Info" configuration option). - Admin info texts and email address ("AdminInfo1", "AdminInfo2" and "AdminEmail" configuration options). - Network name ("Network" configuration option). The limit was 64 bytes before ... Closes #258.
2019-06-29Streamline handling of invalid and unset server nameAlexander Barton
Don't exit during runtime (REHASH command, HUP signal), because the server name can't be changed in this case anyway and the new invalid name will be ignored.
2019-06-29Slightly reoder startup steps, and enhance loggingAlexander Barton
- Show name of configuration file at the beginning of start up. - Add a message when ngIRCd is ready, including its host name. - Show name of configuration file on REHASH (SIGHUP), too. - Change level of "done message" to NOTICE, like "starting" & "ready". - Initialize IO functions before channels, connections, clients, ...
2019-01-022019!Alexander Barton
2018-11-28Implement new configuration option "MaxPenaltyTime" (#251)Alexander Barton
This option configures the maximum penalty time increase in seconds, per penalty event. Set to -1 for no limit (the default), 0 to disable penalties altogether. ngIRCd doesn't use penalty increases higher than 2 seconds during normal operation, so values higher than 1 rarely make sense. Disabling (or reducing) penalties can greatly speed up "make check" runs for example, see below, but are mostly a debugging feature and normally not meant to be used on production systems! Some example timings running "make check" from my macOS workstation: - MaxPenaltyTime not set: 4:41,79s - "MaxPenaltyTime = 1": 3:14,71s - "MaxPenaltyTime = 0": 25,46s Closes #249.
2018-11-28Fix compilation without deprecated OpenSSL APIs (#252)Rosen Penev
2018-10-30Fix some compiler warnings of Apple Xcode/ClangAlexander Barton
For example: * src/ngircd/irc-login.c:102:21: Implicit conversion loses integer precision: 'int' to 'char' * src/ngircd/conn.c:1084:9: Implicit conversion turns floating-point number into integer: 'double' to 'bool' * src/tool/tool.c:85:10: Implicit conversion loses integer precision: 'int' to 'char'
2018-10-30Fix typos/errors/... in file commentsAlexander Barton
Found by Xcode/Clang code analyzer. No functional changes.
2018-10-07Allow a 5th parameter in WEBIRCItsOnlyBinary
According to an IRCv3 extension, the 5th parameter can be used for extra flags that are fine to ignore for now, but limiting WEBIRC params to 4 causes a syntax error. See https://github.com/ircv3/ircv3-ideas/issues/12 for more information. This closes #247.
2018-04-01Initialize listening socket: Streamline error messageAlexander Barton
2018-03-25Correctly retry outgoing conenctions when forking a resolver failedAlexander Barton
When ngIRCd failed to spawn a new resolver subprocess, the connection structure was still marked as "SERVER_WAIT", and no new attempt to connect to this server was made. Thanks to Robert Obermeier for reporting this bug! Closes #243.
2018-03-11Fix use-after-free while handling ERROR during client loginAlexander Barton
This patch fixes a "use after free" bug which is hit while processing ERROR commands while a new client is logging into the server, which leads to only the CLIENT structure becoming freed, but not the CONNECTION structure, too. And this leads to the daemon accessing the already freed CLIENT structure later on ... So now IRC_ERROR() uses the correct function Conn_Close() to correctly free both structures. The CONNECTION structure is cleaned up later on, and the freed CLIENT structure can't be overwritten during normal operations, therefore this bug normally can't crash (DoS) the service -- but you can easily hit it when using the GCC option "-fsanitize=address", or run ngIRCd with Valgrind. Thanks a lot to Joseph Bisch <joseph.bisch@gmail.com> for discovering and reporting this issue!
2018-03-11Only send TOPIC updates to a channel when the topic actually changedAlexander Barton
This prevents the channel from becoming flooded by unecessary TOPIC update messages, that can happen when IRC services try to enforce a certain topic but which is already set (at least on the local server), for example. Therefore still forward it to all servers, but don't inform local clients (still update setter and timestamp information, though!)
2018-02-25Little code cleanups, better commentsAlexander Barton