psychon [Wed, 18 Aug 2010 07:57:23 +0000 (07:57 +0000)]
Fix a NULL pointer dereference in route_replies
When there was only one client with a pending request and that client
disconnected from ZNC, we didn't destroy the timeout. This means that the
associated timer eventually fired and then tried to display which request caused
the timeout. But since we already cleaned up the rest, this resulted in a NULL
pointer dereference.
This commit fixes also another bug: If two different clients got pending
requests and the client whose request was currently handled disconnected, we
didn't send the other client's request to the IRCd.
psychon [Mon, 9 Aug 2010 13:17:08 +0000 (13:17 +0000)]
Fix make output
The output must not use $< since for out-of-tree builds this contains the
relative paths to the file in question. Since $@ will always be in the current
directory, we should use that one instead.
psychon [Thu, 5 Aug 2010 12:13:44 +0000 (12:13 +0000)]
Reduce number of module hooks
The new hooks OnServerCapAccepted() and OnServerCapRejected() are replaced by
OnServerCapResult(). This should force people who want to use this to handle
possible failures in requesting the capability.
psychon [Tue, 3 Aug 2010 10:01:36 +0000 (10:01 +0000)]
Make make's output more readable
The real command line is now hidden and instead a short message which explains
what is done is displayed. To get back the old behavior, use "make VERBOSE=1".
Here's the scenario:
- Client joins #chan, then detaches from #chan (/detach #chan).
- $EVIL_OP kicks us from #chan. Since it's detached, this is not forwarded.
- Client reattaches to #chan (sends us a join for #chan).
What happens is that the client does *not* receive a successful JOIN for the
channel, but TOPIC, MODE and the NAMES reply is forwarded. On proper clients
this would result in weird traffic shown in the server window. On broken clients
like irssi which don't wait for the JOIN reply from the server, this meant that
it looked like a successful JOIN to the client while ZNC still thought the
channel was detached.
This is fixed by automatically attaching to the channel when we join it due to a
client. This means that the channel will always be attached after a JOIN.
Thanks to tomaw for finding this and making me actually understand that this is
a bug in ZNC, not irssi.
This is *NOT* backward compatible with the old name for that config option. If
you updated to the latest nightly in the last two days, well, you'll have to
fix your config by hand. Sorry.
If the CHANTYPES token was the last one in a 005 numeric, partyline would call
std::insert() with CString::npos for the position to insert at. This throws a
std::out_of_range error. Fix this by using CString::append() in this case.
Thanks to Superfly_ for the bug report and helping me reproduce this.
If we were in an user section when we reached the end of the config file, that
user was previously discarded. This makes reading the config file instead.
OnUnknownUserRaw() and OnClientCapRequest() were both getting a CClient* as
their first argument, but the proper way to pass a CClient* argument to a module
is via GetClient(). Since recently, all the places where this module hooks are
called do this properly, so we can remove this bogus argument.
No module that is part of znc is affected by this change.
Let's see how many external ones break. ;)
This commit should make sure that all module calls are done through either
MODULECALL, GLOBALMODULECALL or ALLMODULECALL. Also, in the process some module
calls where ("accidentally" ;) ) fixed to set correct values for a global
module's m_pUser during a module call.
MODULECALL() calls global and user modules, GLOBALMODULECALL() only calls global
modules. The macro arguments are the same, but GLOBALMODULECALL() can live with
a user being NULL while MODULECALL() detests being called like that.
Use fcntl() instead of flock() for locking the config file
fcntl() is more portable than flock() so this makes znc run on more systems
(everyone smile and say hi to solaris). The downside is that fcntl() locks are
lost if *any* fd referring to that file is closed (luckily we don't do that).
The big downside is that the child process after fork() does not inherit the
lock. To work around this, when znc forks into the background, the child process
immediately blocks and tries to get the lock on the config file. Once the parent
releases the lock by exiting, the child will get it.
This shouldn't cause races with other ZNCs, because in every other place we
don't block waiting for a lock but instead abort immediately if the file is
already locked.
Thanks to LeftWing aka Joshua M. Clulow for making znc work on solaris (and
automatically fixing some issues with NFS in the process).
$SHELL controls which shell is used for executing the commands in a Makefile.
Since modules/Makefile does not work with ksh, we need to find a "proper" shell.
Luckily, configure already did that job and announces its findings via @SHELL@.
This should make our Makefile work on Solaris.
Thanks to LeftWing aka Joshua M. Clulow.
Made the antiidle module use HALT instead of HALTCORE so the weird messages never make it to other modules, e.g. colloquy (provided they have been loaded in the right order).
The always-changing versions of the pkg-config m4 macros are mildly annoying.
To work around this, we now have a file aclocal.m4 (generated by aclocal) that
contains all the needed external macros. If you just call "autoconf", it will
use the macros from that file. "autoreconf" will call "aclocal" and "autoconf"
so that both files are up-to-date.
This fixes a bug where the wrong errno value was used for SockError(). This also
fixes a busy loop caused by broken c-ares timeout handling on our side.
psychon [Tue, 29 Jun 2010 19:07:04 +0000 (19:07 +0000)]
Remove OnUser{Attached,Detached}
These are unused functions that are only used for generating warning messages
due to -Woverloaded-virtual. These were introduced in 2008. I think nothing
needs this any more, so let's just remove these for good. Bye, bye.
psychon [Tue, 22 Jun 2010 16:14:31 +0000 (16:14 +0000)]
Correctly handle large CAP lists from the IRCd
As DarthGandalf noticed, the spec asks for an "*" to be prepended if the reply
needs to be split up into multiple lines. It doesn't really matter for the
current code, but let's make this future-proof. :)
psychon [Tue, 22 Jun 2010 15:26:17 +0000 (15:26 +0000)]
Remove CHTTPSock::GetErrorPage()
There is no valid reason to use GetErrorPage() instead of PrintErrorPage() which
can be seen from the fact that all the existing callers are *wrong*. So, to
avoid this mistake in the future, inline GetErrorPage() into its only valid
caller (PrintErrorPage()).
psychon [Tue, 22 Jun 2010 15:18:56 +0000 (15:18 +0000)]
WebMods: Use PrintErrorPage() instead of GetErrorPage()
GetErrorPage() only generates the HTML for the error page while PrintErrorPage()
actually makes sure the error page is sent with the correct HTTP status code.
(We sent all error pages with status "200 OK"!)
psychon [Sun, 20 Jun 2010 15:47:07 +0000 (15:47 +0000)]
route_replies: Handle channel lists
This adds support for querying the channel ban, exempt and invex lists to
route_replies. It doesn't differentiate between the replies since there should
only ever be one of these requests in-flight.
cflakes [Sat, 19 Jun 2010 19:07:24 +0000 (19:07 +0000)]
Fixed an issue identified by Un1matr1x: If you were running two 0.090 ZNCs on the same IP,
(but different ports), any web login session from ZNC #1 would overwrite the session from
ZNC #2. While doing this, also removed an unnecessary check in CHTTPSock::SendCookie and
CHTTPSock::GetRequestCookies (which doesn't transparently translate cookie names and has
never been used so far).
psychon [Sun, 13 Jun 2010 17:14:52 +0000 (17:14 +0000)]
Fix a NULL pointer dereference with traffic stats
When something requested traffic statistics while there was an unauthenticated
connection to ZNC, there was a NULL pointer dereference. Fix this by making the
code saner and removing all NULL pointer dereferences. ;)
Thanks to various people who reported this. A special thank you goes to Woet who
helped debugging this.
psychon [Sun, 13 Jun 2010 07:36:32 +0000 (07:36 +0000)]
Implement CAP between clients and znc
Right now, znc doesn't support any capabilities, but the general protocol works.
This also has the plus point that it stops direct CAP commands between the IRCd
and clients. That's a good thing because different clients might not support the
same CAPs and thus znc would have to translate between them.
psychon [Tue, 8 Jun 2010 19:09:47 +0000 (19:09 +0000)]
GetAnonConnectionCount(): Bugfix
The function counted almost all sockets, but it's only supposed to count inbound
ones which aren't identified client sockets. Do this by adding a check for
"socket is really inbound" in there.
psychon [Mon, 7 Jun 2010 19:05:51 +0000 (19:05 +0000)]
configure: Really automatically disable perl if it's not found
Since r1895 configure tries to disable perl if it doesn't find the perl binary
or libperl, but there was a bug. If the perl binary existed but libperl wasn't
found, it pretended to disable modperl but didn't really. Whoops.
psychon [Mon, 7 Jun 2010 12:41:56 +0000 (12:41 +0000)]
Update fixfreenode
freenode now also allows using CAP to request the identify-msg capability.
Plus point is that one can also disable it via this interface
(CAP REQ :-identify-msg), but we still don't want any client
to enable it at all.
psychon [Thu, 20 May 2010 20:24:30 +0000 (20:24 +0000)]
Print a warning if --enable-run-from-source is missing
If znc was compiled with "--disable-run-from-source" it will check if a file
called "znc-uninstalled.pc" exists in the directory the znc binary is in. If
there is such a file, it will print a warning that "--enable-run-from-source" is
most likely missing.
psychon [Mon, 17 May 2010 13:31:17 +0000 (13:31 +0000)]
autoop: Don't abort ongoing exchange on new joins
When one joined to a channel after someone else's autoop already sent a
challenge, the other autoop will forget it sent a challange and happily generate
a new one. This might cause bogous "incorrect password" messages.
Patch by DarthGandalf, bug found by SilverLeo (I think...).
psychon [Mon, 17 May 2010 13:25:17 +0000 (13:25 +0000)]
Move module's templates to their data dir
Instead of having the template files and images in /usr/share/znc/www/<mod>/,
modules now get to use /usr/share/znc/<mod>/tmpl/ and files/ for this purpose.
This puts those directories for static data to good use again and might even fix
some bugs (after all, the code for that dir is older and more tested than the
new code for www/).