Spelling fixes, mostly in file comments
Return ERR_NOTEXTTOSEND on empty PRIVMSG content They are dropped further down the line anyway; and sending ERR_NOTEXTTOSEND early matches other servers' behavior.
Spelling fixes, mostly in file comments
Fix typos/errors/... in file comments Found by Xcode/Clang code analyzer. No functional changes.
Fix use-after-free while handling ERROR during client login 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!
User mode "C": Allow messages from servers, services, and IRC Ops 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!
Fix compiler warning in Option_String() 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.
Allow IRC Ops and remote servers to KILL service clients (#242) 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.
Don't forward KILLs to other servers if they've been blocked locally This prevents clients from killing IRC services, for example. Closes #238. Closes #239.
Immediately shut down connection on receiving ERROR 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.
Remove leftover debug message. Oops!
Send_Message: Fix handling of "empty" targets 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!
Limit the number of message targes, and suppress duplicates 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.
Add "_MSG" postfix to ERR_WILDTOPLEVEL_MSG
Enahnce comments for Send_Message() and Send_Message_Mask() No functional changes.
Get rid of unclever assert() in Send_Message_Mask() 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)!
IRC_KillClient(): Don't break when called without "Client" 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.
Explicitly cast time_t to long when printing it out This prevents wrong sizes data types on platforms where time_t doesn't equal a long any more, for example on OpenBSD.
Make server-to-server protocol more robust 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!
Update copyright notices of recently changed files