Commit Graph

1653 Commits

Author SHA1 Message Date
psychon 540f867f9b Always prepend 'away :' to *all* away messages, not just the autoaway message.
Consequence of *not* doing this - The following command will unexpectedly cause
ZNC to disconnect from your IRC server:
 /query *away away quit

Thanks to Jim Ramsay <i.am@jimramsay.com> for finding this and providing a patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1672 726aef4b-f618-498e-8847-2d620e286838
2009-12-02 18:16:19 +00:00
psychon 5a08b7b7d6 Really check the return value of strftime()
If strftime() returns 0, the buffer we passed to it shouldn't be touched at
all, because it's not guaranteed to be null-terminated.

Someone (*cough*) already tried to fix this in r1394, but failed badly.

Thanks to DarthGandalf for spotting this and providing a patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1671 726aef4b-f618-498e-8847-2d620e286838
2009-11-30 18:16:16 +00:00
psychon 0cde028bfb ISpoofFormat: Go through ExpandString()
ISpoofFormat now can be used with e.g. %user% which allows some kind of
poor-man's DenySetIdent (force ident to be user name).

For backward compatibility, if ExpandString() doesn't change the string we just
replace all "%" with the user's ident.

Thanks to DarthGandalf for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1670 726aef4b-f618-498e-8847-2d620e286838
2009-11-29 15:17:39 +00:00
psychon 8114f27a5d Fix a crash bug with auth modules
If a module like imapauth needs some time to process a login, it's possible that
the client already disconnected by the time the lookup finished. This would then
cause a stale pointer in CAuthBase to be dereferenced.

Fix this remotely exploitable crash bug by adding a new function
CAuthBase::Invalidate(). After this was called, the CAuthBase instance doesn't
do anything at all anymore, especially not dereferencing the (possibly stale)
m_pSock pointer.

This also makes sure that one can only call AcceptLogin() or RefuseLogin() once.

Thanks to Sm0ke0ut for providing backtraces and reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1669 726aef4b-f618-498e-8847-2d620e286838
2009-11-28 18:53:20 +00:00
silverleo e2aba7587b Revert a commit from r1527 that made some PONG replies pass through to the client.
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1668 726aef4b-f618-498e-8847-2d620e286838
2009-11-24 13:06:25 +00:00
psychon e8c64c0df6 Document the signals
This adds the new SIGUSR1 handling to README and adds a section on SIGINT,
SIGHUP and SIGUSR1 to znc's man page.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1667 726aef4b-f618-498e-8847-2d620e286838
2009-11-20 16:42:44 +00:00
psychon caf295f07f Rewrite znc.conf on SIGUSR1
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1666 726aef4b-f618-498e-8847-2d620e286838
2009-11-20 15:38:21 +00:00
psychon 85d96cdaf5 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 b4ba1d866c 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 7c7f49ec78 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 3ffa684ebf 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 6774696960 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 f2df100cc9 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 eec57eb81e 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 52ee8a11ef 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 91962e32fc 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 cf98214587 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 6426ce107e 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 4930c24f95 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 007754cf6d 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 d55d959554 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 5e0070765b 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 4142762b1d 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 e0e935cd93 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 eb935da142 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 cda8e7c0ba 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 94667c1e90 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 4fffdac655 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 528aa72df3 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 9dd3883164 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 3328e549d1 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 7339f1f1fd 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 fa054942e9 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 f2cf1165f1 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 5ccbd002c0 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 6cdc7fb527 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 ed085ad1c6 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 25ce7c8d6f Increase the version number to 0.076
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1634 726aef4b-f618-498e-8847-2d620e286838
znc-0.076
2009-09-24 19:04:57 +00:00
sebastinas fdb9f6ce01 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 2ecfbf940b 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 1ac094fbb6 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 59d7b8a7cf 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 159649ea96 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 3b058ec02a 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 7c899a1d0c 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 0ba3b52174 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 da081370c0 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 f1338fde5c 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 c3e87feb27 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 0c160c0720 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