Both of these headers were added in C99 and this standard says that inttypes.h
should #include stdint.h. But Solaris 9 (and others?) doesn't have any stdint.h
header and thus the compiler shoots at us. So we just get our uint32_t from
inttypes.h instead and everyone should be happy...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1665 726aef4b-f618-498e-8847-2d620e286838
At the time that OpenModule() verified that the module's version number matched
the version of the currently running ZNC, it had already called two of the
functions exported from the module.
Reorder this so that we don't do *any* other calls if we get a version mismatch.
Thanks to KiNgMaR for noticing this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1663 726aef4b-f618-498e-8847-2d620e286838
(aka: Brown Paper Bag commit)
When I tested it, it did work. I swear!
Thanks to everyone who pointed out that I broke his znc.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1662 726aef4b-f618-498e-8847-2d620e286838
One can now disable the timeout messages with '/msg *route_replies silent yes'
and the message shown on timeout sounds less grave.
It would be best if we could fix all of the timeout bugs, but most of the
reports we got lately sound like they were caused by cosmic rays or something...
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1660 726aef4b-f618-498e-8847-2d620e286838
Instead of generating a "this module hit a BUG" after 20s this module now waits
60s for a reply. This should cause less "wrong" bug reports for us.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1657 726aef4b-f618-498e-8847-2d620e286838
If some client now sets "us" away via /away, new clients will be sent a 306
numeric after login to inform them that they are set /away.
Thanks to nobswolf for the suggestion.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1655 726aef4b-f618-498e-8847-2d620e286838
This file is only ever out-of-date and --makeconf makes this pretty much
obsolete anyway. Oh and too many users are confused by this file.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1654 726aef4b-f618-498e-8847-2d620e286838
If you know clone a user through admin's clone command, that user won't connect
to irc. When the new user first logs in he will be told to use '/msg *status
connect'.
Thanks to BLG and KiNgMaR for the idea and the 'patch'.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1653 726aef4b-f618-498e-8847-2d620e286838
CModule::RemTimer(const CString& sLabel) now uses FindTimer() and
RemTimer(CTimer *) to do the work instead of doing all of this by itself.
Thanks to KiNgMaR again.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1651 726aef4b-f618-498e-8847-2d620e286838
CModule::RemTimer(CTimer* pTimer) only removed the timer from CModule's own list
of timers but didn't actually destroy the timer. This meant that the timer could
continue to run after it was supposed to be deleted.
Because CModule's destructor used this function this means that all timers
active when a module is unloaded where leaked. When these timers where then
later destroyed this caused a crash because their vtable points inside the
module which was already unloaded (not good!).
Thanks to KiNgMaR for finding and reporting this crash bug.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1650 726aef4b-f618-498e-8847-2d620e286838
If this option is set to an ip address, this one is used as the local address
for DCC connections. This can e.g. be used to "fix" DCC bouncing with ipv6
connections. Without it, this just more or less fails badly.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1647 726aef4b-f618-498e-8847-2d620e286838
With this patch configure no longer fails if either pkg-config or c-ares are
unavailable. Instead, c-ares is just disabled.
If one uses ./configure --enable-c-ares, configure will fail if c-ares is not
found.
./configure --disable-c-ares obviously won't care about c-ares. ;)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1644 726aef4b-f618-498e-8847-2d620e286838
CModule has two vectors: A list of timers and a list of sockets for this
module. Since one shouldn't be able to add items multiple times it makes sense
to use a set here instead.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1643 726aef4b-f618-498e-8847-2d620e286838
ZNC now writes its config file just before it shuts down. If this fails it
aborts the shutdown. One can then either fix whatever went wrong or force a
shutdown.
This also cleans the code up a little by unifying shutdown and restart.
Patch by flakes, thanks!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1641 726aef4b-f618-498e-8847-2d620e286838
Before this you could only give the hostname of a server and delserver would
delete the first server with that hostname. Now you can also specify port and
password to select the server to remove more exactly.
One can't specify the ssl flag for delserver since this would be a little ugly,
but since you can't do ssl/plain-text on the same port anyway this shouldn't be
a big problem.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1640 726aef4b-f618-498e-8847-2d620e286838
configure automatically sets the prefix to /usr/local if the user didn't set one
explicitly with --prefix, but it does so later than our own code. This must have
been a problem in the past, but now everything works fine without this hack.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1637 726aef4b-f618-498e-8847-2d620e286838
A queue is a FIFO while a stack is a LIFO. The code which added paths to the
list of available paths expected them to be checked in the order they were
added, but instead they were checked in reverse order. This meant that one could
no longer replace "system modules" with a .so in ~/.znc/modules.
Thanks to DarthGandalf for noticing and reporting this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1629 726aef4b-f618-498e-8847-2d620e286838
Thanks to tylerdu who reported that cloning an admin user who got admin-only
modules (e.g. listsockets) loaded skips those modules. This is fixed by handling
modules last in CUser::Clone(). Other stuff like e.g. the Admin flag are now
handled before the modules are and thus loading listsockets doesn't fail with
"You must be admin to use this module".
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1628 726aef4b-f618-498e-8847-2d620e286838
If you save a password in your browser that password is bound to the "realm" of
the authentication. Since ZNC included its version number in this, all your
saved passwords were rendered useless on upgrade.
Avoid this by not including the version number in the HTTP authentication realm.
Thanks to tylerdu for reporting this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1627 726aef4b-f618-498e-8847-2d620e286838
webadmin loaded a user's modules before it set its admin flag - fix this by
changing the order.
webadmin failed at setting a new user's admin flag. This is fixed too.
Thanks to DarthGandalf for reporting this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1625 726aef4b-f618-498e-8847-2d620e286838
CZNC::~CZNC() set its pointer to the CConnectUserTimer to NULL and then called
the manager's Cleanup(). If some destructor that is called from here then calls
EnableConnectUser(), a new CConnectUserTimer is created and its address is
saved. But since the manager is destroying all timers, this pointer will soon
become dangling and might crash us later on.
This is solved by clearing CZNC's pointer in CConnectUserTimer's destructor.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1624 726aef4b-f618-498e-8847-2d620e286838
The CJoinTimer which fired every 20s made the user try to join channels if there
were still some channels pending.
The CMiscTimer checked every 30s if a irc or client socket is near its timeout
and sent a "PING" if it was.
The new CUserTimer now does both every 30s.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1623 726aef4b-f618-498e-8847-2d620e286838
We used to start a dedicated timer for a new client socket that would make sure
the client is disconnected if it didn't successfully log in after 60 seconds.
This is now replaced by using Csocket's built-in timeout support. When a new
client connects we SetTimeout(60, 0); which means that Timeout() will be called
in 60 seconds, no matter what. The second argument is a bitmask which says on
which events the timeout should be reset (TMO_READ, TMO_WRITE, TMO_ACCEPT,
TMO_ALL).
Once the client logs in successfully, CClient::AcceptLogin() now sets back the
proper timeout (SetTimeout(240, TMO_READ);) which was set in Connected() before.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1622 726aef4b-f618-498e-8847-2d620e286838
Thanks to ViciousPotato for reporting that AltNicks were truncated to 9
characters.
We assumed the server's maximum nick length to be 9 by default which made the
code truncate the AltNick to 9 characters.
Now we save the nick we sent last to the IRC server. If the server reports a
"nick is already in use" with a nick shorter than we sent it, we assume this
that the server truncated our nick to the allowed length and use this length for
our retries (appending different characters to the default nick).
Not all irc servers truncate the nick this way if it's too long, on those that
don't this patch shouldn't cause any behavior change.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1620 726aef4b-f618-498e-8847-2d620e286838
This imports the sha256 code from http://www.ouah.org/ogay/sha2/ (The other
hashes from sha-2 were removed). sha256 is a much stronger hashing algorithm
than md5 is (There were successful birthday attacks against md5).
All the code now defaults to creating sha256 salted hashes (The salting used is
the same as before).
Old znc.conf files can still be read.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1618 726aef4b-f618-498e-8847-2d620e286838
When webadmin "grabs" HTTP connections from the IRC port, it moves the
underlying connection to its own socket class and copies all of the settings
from the old socket to this new one.
One of the properties that is copied is the MaxBufferThreshold which is 1024 for
IRC sockets, but which should be 10240 webadmin sockets (CSocket::CSocket()).
This could theoretically cause bugs like the "blank page in firefox" reported by
kaiz0ku.
Anyway, this is hopefully fixed by setting the 10k MaxBufferThreshold again.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1617 726aef4b-f618-498e-8847-2d620e286838
Before this, savebuff also added messages if a client was connected and a
channel had KeepBuffer = false which is obviously wrong.
Thanks to _marix for reporting this.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1616 726aef4b-f618-498e-8847-2d620e286838