Commit Graph

1647 Commits

Author SHA1 Message Date
psychon
a8a7525dfd SHA256.h: Include inttypes.h instead of stdint.h
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
2009-11-19 20:59:40 +00:00
psychon
f508413444 MODCONSTRUCTOR: Move some stuff to MODCOMMONDEFS
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1664 726aef4b-f618-498e-8847-2d620e286838
2009-11-16 18:13:09 +00:00
psychon
109ece2de6 CModules::OpenModule(): Check the version number first
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
2009-11-16 18:11:53 +00:00
psychon
07fd781c83 Bug fix for my last commit
(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
2009-11-15 18:47:28 +00:00
psychon
d96d16634b Module ABI: Use a string pointer
Returning a const char* is way easier, makes way more sense and is way
friendlier for an extern "C" function.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1661 726aef4b-f618-498e-8847-2d620e286838
2009-11-15 13:29:17 +00:00
psychon
aa32e1f3bb route_replies: Improve the timeout handling
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
2009-11-15 13:03:48 +00:00
psychon
77dd0c2f98 Bug fix for CUser::DelServer()
DelServer() didn't always update m_uServerIdx correctly which means
GetCurServer() started to return the wrong server. This should now be fixed.

This log shows the bug. ZNC starts to think it's connected to irc.efnet.nl:

<znc_psy> listservers
<*status> +-------------------+------+-----+------+
<*status> | Host              | Port | SSL | Pass |
<*status> +-------------------+------+-----+------+
<*status> | irc.efnet.pl      | 6667 |     |      |
<*status> | irc.spotchat.org* | 6667 |     |      |
<*status> | irc.efnet.nl      | 6667 |     |      |
<*status> | irc.freenode.org  | 6667 |     |      |
<*status> +-------------------+------+-----+------+
<znc_psy> delserver irc.efnet.pl
<*status> Server removed
<znc_psy> listservers
<*status> +------------------+------+-----+------+
<*status> | Host             | Port | SSL | Pass |
<*status> +------------------+------+-----+------+
<*status> | irc.spotchat.org | 6667 |     |      |
<*status> | irc.efnet.nl*    | 6667 |     |      |
<*status> | irc.freenode.org | 6667 |     |      |
<*status> +------------------+------+-----+------+

Thanks to tomaw for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1659 726aef4b-f618-498e-8847-2d620e286838
2009-11-14 12:03:03 +00:00
psychon
a68f3a6b89 Some small cleanup to CUser::Clone()
This shouldn't change anything except the readers ability to understand this
snippet (hopefully).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1658 726aef4b-f618-498e-8847-2d620e286838
2009-11-14 11:36:19 +00:00
psychon
425a1b5fff route_replies: Increase the timeout
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
2009-11-13 21:35:24 +00:00
psychon
ed6db33d13 Reorder the numerics in IRCSock.cpp
They are now sorted (where possible).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1656 726aef4b-f618-498e-8847-2d620e286838
2009-11-07 15:08:27 +00:00
psychon
ff4e09c594 Send correct away status on client login
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
2009-11-07 14:54:45 +00:00
psychon
aea6c40a0e Remove sample znc.conf
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
2009-10-24 07:50:04 +00:00
psychon
606fdaf166 admin: Disable ConnectEnabled() for cloned users
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
2009-10-20 16:59:40 +00:00
psychon
3f493072b3 OnIRCConnecting(): Log abort-by-module
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1652 726aef4b-f618-498e-8847-2d620e286838
2009-10-20 16:53:22 +00:00
psychon
03f3e348e4 Micro-optimization: Use existing functions in CModule::RemTimer()
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
2009-10-17 15:50:58 +00:00
psychon
78af088fd7 Fix a memory leak/crash in CModule
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
2009-10-17 15:44:51 +00:00
psychon
78401ea10a Remove connect_throttle module from extra
fail2ban does the job much better (and is based on connect_throttle btw).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1649 726aef4b-f618-498e-8847-2d620e286838
2009-10-15 14:38:02 +00:00
psychon
404ab48408 blockuser: Add a missing admin check
Non-admin users should not be able to block any users. Really, they shouldn't.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1648 726aef4b-f618-498e-8847-2d620e286838
2009-10-11 12:58:48 +00:00
psychon
ade1ee5418 Add a new DCCVHost config option
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
2009-10-10 12:45:25 +00:00
psychon
3881bece33 Comment out some weird code from Client.cpp
Suggestions for what this was good for?


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1646 726aef4b-f618-498e-8847-2d620e286838
2009-10-10 12:29:40 +00:00
psychon
ad0cba603d Regenerate configure
No idea why, but autoconf failed badly on that last commit. :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1645 726aef4b-f618-498e-8847-2d620e286838
2009-10-09 17:11:49 +00:00
psychon
158702a9c3 configure: Automatically disable c-ares if it is not found
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
2009-10-09 17:07:22 +00:00
psychon
c88ec5f91d Use a set instead of a vector in CModule
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
2009-10-05 20:44:54 +00:00
psychon
7361b87130 Remove the old, unused function CUtils::GetHashPass()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1642 726aef4b-f618-498e-8847-2d620e286838
2009-10-05 20:03:20 +00:00
psychon
24978bd0eb Write the config file on restart and shutdown
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
2009-10-04 17:15:05 +00:00
psychon
4d35bd482e delserver: Allow selecting the server more exactly
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
2009-09-26 18:41:24 +00:00
psychon
ab71a24bba Micro-Optimizations
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1639 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 15:04:08 +00:00
psychon
d0a38e41ab Add a new module hook OnIRCConnecting
This hook is called just before some user tries to connect() to an IRC server.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1638 726aef4b-f618-498e-8847-2d620e286838
2009-09-26 14:49:15 +00:00
psychon
653eb8a0e0 configure.in: Don't explicitly set default prefix
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
2009-09-24 19:38:36 +00:00
psychon
08045fff41 Increase the version number to 0.077
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1636 726aef4b-f618-498e-8847-2d620e286838
2009-09-24 19:06:46 +00:00
psychon
738d8aca64 Increase the version number to 0.076
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1634 726aef4b-f618-498e-8847-2d620e286838
2009-09-24 19:04:57 +00:00
sebastinas
6efff7c402 admin: Fix the output of "help".
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1633 726aef4b-f618-498e-8847-2d620e286838
2009-09-24 10:24:17 +00:00
psychon
a190d97cae admin: Fix the help for "setchan"
Thanks to flakes.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1632 726aef4b-f618-498e-8847-2d620e286838
2009-09-24 10:20:23 +00:00
psychon
e259594035 Fix some minor errors in webadmin's CSS files
Thanks to everyone who reported this and helped testing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1631 726aef4b-f618-498e-8847-2d620e286838
2009-09-18 18:26:20 +00:00
psychon
7e61148a19 Use more sane and proper English in configure
Thanks to Kuja


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1630 726aef4b-f618-498e-8847-2d620e286838
2009-09-18 07:54:23 +00:00
psychon
5d5493a24f Use a queue instead of a stack for the list of module paths
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
2009-09-17 18:39:46 +00:00
psychon
bd7bc1ffc4 CUser::Clone(): Handle modules after all other user settings
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
2009-09-14 18:45:07 +00:00
psychon
98e37dd547 Webadmin: Don't include the ZNC version in the basic auth realm
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
2009-09-14 17:23:40 +00:00
psychon
2a14222ef5 Move saslauth into modules/extra/
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1626 726aef4b-f618-498e-8847-2d620e286838
2009-09-14 12:17:17 +00:00
psychon
f5d7ffe41a webadmin: Be able to add new admin users with shell module loaded
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
2009-09-11 12:46:40 +00:00
psychon
79212882e3 Fix a theoretical crash on shutdown
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
2009-09-10 18:27:56 +00:00
psychon
5fea8a69c1 Unify CJoinTimer and CMiscTimer to CUserTimer
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
2009-09-10 10:50:48 +00:00
psychon
edb6c42dd8 Remove the dedicated new-client-timeout timer
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
2009-09-10 10:45:35 +00:00
psychon
2137d5a7cf Update to latest Csocket
This fixes a minor bug where a socket's timeout mode was changed when it was
copied to another socket.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1621 726aef4b-f618-498e-8847-2d620e286838
2009-09-10 06:30:34 +00:00
psychon
0104d3c5dc Improve the AltNick handling
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
2009-09-09 10:15:36 +00:00
psychon
868e5343c2 Remove an unnecessary include from modules/Makefile
All dependency files are creates in .depend, there is no .depend/extra subdir.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1619 726aef4b-f618-498e-8847-2d620e286838
2009-09-08 20:44:12 +00:00
psychon
cd63bae006 Add sha256 support
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
2009-09-07 18:55:07 +00:00
psychon
cfe64df399 webadmin: Increase buffer on HTTP sockets on the irc port
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
2009-09-07 18:33:02 +00:00
psychon
ecc5973aed savebuff: Honour the KeepBuffer setting
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
2009-09-04 12:25:05 +00:00
psychon
9bb57639e1 Update to latest Csocket
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1615 726aef4b-f618-498e-8847-2d620e286838
2009-09-02 17:26:06 +00:00