about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)Author
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
2018-02-25User mode "C": Allow messages from servers, services, and IRC OpsAlexander Barton
Update user mode "C" handling ("Only users that share a channel are allowed to send messages") to behave like user mode "b" ("block private messages and notices") and therefore allow messages from servers, services, and IRC Operators, too. Change proposed by "wowaname" in #ngircd, thanks!
2018-02-25portab/Makefile: Split list into separate linesAlexander Barton
2018-02-092018!Alexander Barton
2018-01-29Fix compiler warning in ForwardLookup()Alexander Barton
When compiling without "working getaddrinfo()", the "af" parameter of ForwardLookup() is unused by that function. Mark it as such! This prevents the following compiler warning: resolve.c:235:56: warning: unused parameter ‘af’ [-Wunused-parameter]
2018-01-29Fix compiler warning in Option_String()Alexander Barton
When compiling ngIRCd without support for SSL and without support for ZLIB, gcc outputs the following warning: irc.c:493:9: warning: variable ‘options’ set but not used [-Wunused-but-set-variable] Fix it by providing a dummy function in this case.
2018-01-29Fix Get_Error() usage, take IIAlexander Barton
This should fix the following compiler warning: resolve.c:113:1: warning: ‘Get_Error’ defined but not used [-Wunused-function] Which can happen, because the logic of commit 543f44bf isn't sufficient: Get_Error() is only used when neither HAVE_WORKING_GETADDRINFO nor HAVE_GETNAMEINFO are set ... Enhances 543f44bf. Closes #241.
2017-09-30Allow IRC Ops and remote servers to KILL service clients (#242)Alexander Barton
In the end, service clients behave like regular users, therefore IRC operators and servers should be able to KILL them: for example to resolve nick collisions. This is related to #238.
2017-09-26Don't forward KILLs to other servers if they've been blocked locallyJames Lu
This prevents clients from killing IRC services, for example. Closes #238. Closes #239.
2017-09-13Fix Get_error usageBernd Kuhls
The usage of Get_Error is guarded by "ifdef h_errno" in this file, the definition of this function should follow the same rules. Fixes a build error when cross-compiling: https://github.com/ngircd/ngircd/issues/223
2017-01-19Fix handling of connection pool allocation and enlargementAlexander Barton
The daemon only enlarged its connection pool when accepting new client connections, not when establishing new outgoing server links. Thanks to Lukas Braun (k00mi) for reporting this! In addition this patch streamlines the connection pool allocation, so that there is only one place in the code allocating the pool: the now updated Socket2Index() function. The name doesn't quite fit, but this existing and today quite useless function (because the mapping from socket number to connection index is 1:1 today) already became called in almost all relevant code paths, so I decided to reuse it to keep the patch small ...probably we want to fix the naming in a second patch? Closes #231.
2017-01-152017!Alexander Barton
2016-12-08Log privilege violations and failed OPER as "error" and to &serverAlexander Barton
2016-12-08Immediately shut down connection on receiving ERRORAlexander Barton
Don't wait for the peer to close the connection. This allows us to forward the ERROR mesage in the network, instead of the very generic "client closed connection" message.
2016-12-08x-Line synchronization: Don't send negative durationsAlexander Barton
2016-12-08List expiration: use same log level as when settingAlexander Barton
And log this event to the &SERVER channel, too.
2016-12-08Remove leftover debug message. Oops!Alexander Barton
2016-12-08G-LINES: Forbid remote modifications if "AllowRemoteOper" is not setAlexander Barton
Explicitely forbid remote servers to modify "x-lines" (G-LINES) when the "AllowRemoteOper" configuration option isn't set, even when the command seems to originate from the remote server itself: this prevents GLINE's to become set during server handshake in this case (what wouldn't be possible during regular runtime when a remote IRC Op sends the command) and what can't be undone by IRC Ops later on (because of the missing "AllowRemoteOper" option) ...
2016-12-05Fix building ngIRCd with OpenSSL 1.1Christoph Biedl
At the moment, ngIRCd fails to build against OpenSSL 1.1 since the configure check probes for the SSL_library_init symbol which was removed, but probing for a different function availabe in both versions solves that problem: SSL_new(). And as SSL_library_init is no longer needed, the patch boils down to probing SSL_new to assert libssl is available, and disabling the SSL_library_init invokation from OpenSSL 1.1 on, see also another application[1] (NSCA-ng) that did pretty much the same. Patch was compile-tested on both Debian jessie (OpenSSL 1.0.2) and stretch (OpenSSL 1.1). [1] <https://www.nsca-ng.org/cgi-bin/repository/nsca-ng/commit/?id=8afc22031ff174f02caad4afc83fa5dff2c29f8a> (Patch by Christoph, commit message cherry-picked from the email thread on the mailing list by Alex. Thanks!)
2016-12-05gcc 6.2 warnings: fix code indentationAlexander Barton
This fixes the following correct -Wmisleading-indentation warning messages of gcc 6.2: irc-write.c: In function ‘IRC_SendWallops’: irc-write.c:521:4: warning: this ‘if’ clause does not guard... irc-write.c:524:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ irc-write.c:526:4: warning: this ‘if’ clause does not guard... [] irc-write.c:529:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘if’ irc-info.c: In function ‘IRC_STATS’: irc-info.c:895:3: warning: this ‘else’ clause does not guard... irc-info.c:897:4: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘else’ No functional changes, the code has been correct, but the indentation was wrong ...
2016-07-22Make sure that SYSCONFDIR is always setAlexander Barton
This is useful when ./configure hasn't been run but some source code linters are run in an editor, for example.
2016-06-05Add PAMServiceName setting to specify the used PAM configurationChristian Aistleitner
This setting allows to run multiple ngIRCd instances with PAM configurations on each instance. If one sets it to "ngircd-foo", PAM will use `/etc/pam.d/ngircd-foo` instead of the default `/etc/pam.d/ngircd`.
2016-01-07Send_Message: Fix handling of "empty" targetsAlexander Barton
Clients can specify multiple targets for the "PRIVMSG", "NOTICE", and "SQUERY" commands, separated by commas (e. g. "PRIVMSG a,#b,c :text"). Since commit 49ab79d0 ("Limit the number of message targes, and suppress duplicates"), ngIRCd crashed when the client sent the separator character only as target(s), e. g. "," or ",,,," etc.! This patch fixes the bug and adds a test case for this issue. Thanks to Florian Westphal <fw@strlen.de> for spotting the issue!
2016-01-04Update copyright notices for 2016Alexander Barton
2016-01-04Limit the number of message targes, and suppress duplicatesAlexander Barton
This prevents an user from flooding the server using commands like this: PRIVMSG nick1,nick1,nick1,... Duplicate targets are suppressed silently (channels and clients). In addition, the maximum number of targets per PRIVMSG/NOTICE/... command are limited to MAX_HNDL_TARGETS (25). If there are more, the daemon sends the new 407 (ERR_TOOMANYTARGETS_MSG) numeric, containing the first target that hasn't been handled any more. Closes #187.
2016-01-04Add "_MSG" postfix to ERR_WILDTOPLEVEL_MSGAlexander Barton
2016-01-04Enahnce comments for Send_Message() and Send_Message_Mask()Alexander Barton
No functional changes.
2016-01-04Get rid of unclever assert() in Send_Message_Mask()Alexander Barton
Either we use assert() to _guarantee_ a certain condition, or we use if(...) to test for it. But never both. So get rid of the assert() in Send_Message_Mask() and handle the case that the target mask doesn't contain a dot (".") as regular error, don't require the caller to assure that any more. This polishes commit 5a312824. Please note: The test in Send_Message() is still _required_ to detect whether the target is a channel (no dot) or a "target mask" (at least one dot)!
2015-12-30Test suite: Add new test for server-server loginsAlexander Barton
This test detects the recent NJOIN breakage, for example ...
2015-12-30Fix NJOIN handler killing all clientsAlexander Barton
This bug has been introduced by commit 1e386fb7ac which had the logic reversed :-( Reported by "ninguno" in #ngircd, thanks a lot!
2015-12-13Make NJOIN handler more fault-tolerantAlexander Barton
Don't crash the daemon when the NJOIN handler can't join the new client to a channel (when the Channel_Join() function failed) but try to KILL this client -- which is the only possible reaction besides crashing: otherwise the network would get out of sync.
2015-12-13IRC_KillClient(): Don't break when called without "Client"Alexander Barton
The IRC_KillClient() function is documented to handle the case that the "Client" structure is NULL, so make sure that this actually works and can't crash the daemon. Please note: The current code doesn't make use of this feature, so this fix is definitely the "right" thing to do but doesn't fix an actual problem.
2015-12-13IRC_NJOIN(): Code cleanupAlexander Barton
No functional changes.
2015-12-13Fix NJOIN not propagating "half ops" statusAlexander Barton
ngIRCd tested for the wrong prefix of "half ops" when processing NJOIN commands and therefore never classified a remote user as "half op". Thanks to wowaname for pointing this out on #ngircd!
2015-11-15Explicitly cast time_t to long when printing it outAlexander Barton
This prevents wrong sizes data types on platforms where time_t doesn't equal a long any more, for example on OpenBSD.
2015-09-03Make server-to-server protocol more robustAlexander Barton
Now ngIRCd catches more errors on the server-to-server (S2S) protocol that could crash the daemon before. This hasn't been a real problem because the IRC S2S protocol is "trusted" by design, but the behavior is much better now. Thanks to wowaname on #ngircd for pointing this out!
2015-08-26Reproducible buildsChristoph Biedl
At the moment ngircd fails the tests for reproducible builds in Debian since it uses the __DATE__ and __TIME__ macros for the INFO command. Instead of patching this out I decided to implement an optional constant BIRTHTIME that allows you to set a time stamp for the "Birth Date" information, in seconds since the epoch, like in export CFLAGS += -DBIRTHTIME=$(shell date +%s --date="2015/08/15 23:42:22") In the future, Debian will provide a SOURCE_DATE_EPOCH environment variable, dealing with the situation until then will be my job. The time format was taken from the NGIRCd_StartStr formatting in ngircd.c so the "Birth Date" and "On-line since" lines in the INFO output look similar: :irc.example.net 371 nick :ngIRCd 22.1-IDENT+IPv6+IRCPLUS+PAM+SSL+SYSLOG+ZLIB-x86_64/pc/linux-gnu :irc.example.net 371 nick :Birth Date: Tue Aug 25 2015 at 18:11:11 (CEST) :irc.example.net 371 nick :On-line since Tue Aug 25 2015 at 18:11:33 (CEST) :irc.example.net 374 nick :End of INFO list The format of the time stamped is changed, but as far as I can tell, there's no rule that is violated by that. Bonus level: Reformat the messages so the time stamps are aligned.
2015-08-01Whitespace fixes (no functional changes)Alexander Barton
2015-08-01Fix debug message "Client ... is closing connection"Alexander Barton
It should be "host:port"!