Uli Schlachter [Fri, 5 Aug 2011 13:02:04 +0000 (15:02 +0200)]
Include zncconfig.h in all headers
The rule is that zncconfig.h must be the very same thing that is included. We
cheat and only include it in headers (so that modules dont have to have be
changed). However, it looks like some modules where missed.
This commit fixes test/ConfigTest which crashed if _GLIBCXX_DEBUG was enabled
(--enable-debug) because it didn't see this define before including a c++
header.
Uli Schlachter [Wed, 3 Aug 2011 20:05:21 +0000 (22:05 +0200)]
Stop asking for the host name in --makepem
Come on, it's a self-signed certificate, how much value does it have anyway?
Also, it gets rid of a question during --makeconf which confuses some people.
This should now use $HOSTNAME and fall back to "host.unknown" if that isn't set.
Since commit 1a1cc4c756e, we'd always send a "MODE #chan" to IRC when we
received a "JOIN #chan". It used to work before that commit, because the mode
reply which is automatically sent on join is sent before the "end of /names"
numeric.
This just removes that MODE request. Proper IRC server should always send a MODE
reply on channel join.
When we hit the "maximum open files" limit, we close the listener that hit this
error. Previously we did so silently which means no one could figure out what
happened.
This commits adds a broadcast message giving a hint, but this should never
happen in a real-world situation anyway (unless you have 1000 users).
This fixes the "busy loop waiting for an SSL handshake to finish" which the last
"Update to latest Csocket" was already supposed to fix. However, that fix had a
bug if poll() is used instead of select().
poll()'s timeout argument is in milliseconds while select also allows
microseconds. Since Csocket originally used select(), it expects the
microseconds-approach. This means it has to divide by 1000 to get the timeout
argument for poll().
However, the iQuickReset which was used to "fix" (rather: hide) the busy loop
was less than 1ms so this still resulted in a timeout of 0 (= busy loop) because
integer division truncates the result.
This means that they will get a new cookie on the next request. This will make
sure that you will be able to use webadmin again if your IP changed (which seems
to happen to quite a number of people).
This helps people figuring out that they are still building their modules for
the wrong znc version since they have more than one installation on their box.
Uli Schlachter [Sun, 26 Jun 2011 10:11:40 +0000 (12:11 +0200)]
Update to latest Csocket
Fixes:
- A possible crash bug for empty DNS replies with c-ares. E.g. a AAAA lookup for
google.com doesn't give any reply but is still successful. This might be a
c-ares bug (there is ARES_ENODATA) or c-ares just changed its behavior?
(No bug report, just noticed accidentally)
- Connecting to ipv4-only hosts with a v6 bindhost caused weird errors:
https://github.com/znc/znc/issues/47
- There was a pull request for some DSA server certificate thingy:
https://github.com/znc/znc/pull/46
- Busy loop waiting for an SSL handshake to finish:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=631590
- Some other stuff? No idea what some of the changes in here are actually doing.
Uli Schlachter [Mon, 13 Jun 2011 13:19:17 +0000 (15:19 +0200)]
Fix a bug in MCString::Encode()
For character values above 127, the signed char that could be used here did the
wrong thing. That is, *it >> 4 returned a negative value and the array hexdigits
was read indexed with that wrong value.
Fix this by explicitly using unsigned char.
Thanks to crocket for reporting this bug which he found with perform (broken
entries after a restart/reload).
Uli Schlachter [Sat, 11 Jun 2011 16:33:50 +0000 (18:33 +0200)]
Only export a single function from modules
This moves the version check into the function which loads the module info. That
way, we just need a single dlsym() call per module and thus can't get any errors
from the second dlsym() call. And IMHO this feels nicer anyway. ;-)
Alexey Sokolov [Sat, 11 Jun 2011 10:28:15 +0000 (17:28 +0700)]
Add a way for module to customize additional info.
For that you need to write a specialization of template function
void TModInfo<CYourModule>(CModInfo&), and inside it put needed values
to the argument.
Uli Schlachter [Sun, 15 May 2011 11:15:51 +0000 (13:15 +0200)]
autoattach: Allow limiting by hostmask
This adds hostmasks to autoattach. E.g. if you don't like me, you add an entry
of "! * psychon!*" and autoattach won't attach you to channels just because I
said something. The same can be done in the non-negated case, "only attach when
foo says something".
This fixes a problem where Csocket detected socket timeouts (as configured with
SetTimeout()) too late if there was few activity. See csocket's git commit
message for more info, I'm lazy. :-P
Michael Edgar [Thu, 14 Apr 2011 00:24:26 +0000 (20:24 -0400)]
Added a global config option for IP-based session protection.
The new setting defaults to true, and is settable in the web admin panel. When
set to false, IP address checks are ignored. For users behind proxies (students,
large corporate networks) that don't guarantee a consistent IP, this makes the
web admin panel much more usable.
Congratulations, Apple. Your OS is really great. In some versions (according to
google, it used to work in older releases), poll() can only handle sockets. If
you give it a pipe (as e.g. the shell module does), it will fail with POLLNVAL
which Csocket handles by going into an endless loop.
That functionality was accessible by perl and python modules before.
Now that stuff is in own headers, so let's parse them too,
to have them still be able to use this.
Both these headers only really need CFile* which can be handled with a forward
declaration.
To make this possible, some methods are moved from the header file into the
corresponding implementation file, because they used CFile or CDir static
members.
ZNC will now send a PING if the connection was idle for 270 to 300 seconds.
After 540 seconds (that is, about 270 to 240 seconds later) the timeout is
triggered and ZNC reconnects.
These values are "inspired" by the values eggdrop uses.
The old timeouts were 180 to 210 secs for the PING and 240 secs for the timeout.
Instead of doing ugly stuff to shorten the "Loaded Module [foo]" message, we now
just always generate the shorter version of that message. The code paths which
didn't do this shortening now prepend that message themselves.
The result is that every message looks the same as it did before, but the code
for generating these is a little nicer.