Commit Graph

2038 Commits

Author SHA1 Message Date
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
psychon
cf2af84c67 route_replies: Handle 401 for /names
Thanks to Kuja for reporting that route_replies doesn't handle the "no such
nick/channel" numeric.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1614 726aef4b-f618-498e-8847-2d620e286838
2009-09-02 17:22:34 +00:00
psychon
64b0e392fe Add CModules::GetModPathInfo()
This function works like GetModInfo(), but takes the full path to the module,
too.

This is used to speed up GetAvailableMods(). Before it created a list of module
paths, extracted the names and then called GetModInfo() on those module names
which looked up the path for the modules again. This extra step is now skipped
and the module's path is used directly.

To make this work, the call to FindModPath() was moved from OpenModule() into
its two callers LoadModule() and GetModInfo().


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1613 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 14:11:37 +00:00
psychon
ab9e2dfd33 Add CModules::GetModDirs()
This function returns a list of <module dir, data dir> pairs which lists all
places in which modules should be looked for.

FindModPath() and GetAvailableMods() are changed to use this new function.

The list of places to look at is the same that was used before, but this now
also adds ./modules/extra so that modules enabled via --enable-extra are found
before 'make install'.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1612 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 12:46:47 +00:00
psychon
6a36100447 Move CZNC::FindModPath() to CModules
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1611 726aef4b-f618-498e-8847-2d620e286838
2009-08-23 11:05:22 +00:00
psychon
495c196a82 Fix out-of-tree builds
Instead of using sed to strip away the source dir this now uses make's notdir.
$(notdir this/is/an/example) results in example.

This also moved the generated dependency files from .depend/extra into .depend/

Since we need the extra/ path prefix for the modules from modules/extra, that
one is added back via addprefix.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1610 726aef4b-f618-498e-8847-2d620e286838
2009-08-22 16:03:51 +00:00
psychon
61449c6f97 Import SilverLeo's modtcl from znc-extra
The configure and Makefile stuff was taken from there, too. By default modtcl is
disabled, use --enable-extra --enable-tcl to get it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1609 726aef4b-f618-498e-8847-2d620e286838
2009-08-22 15:45:32 +00:00
psychon
a675e474e5 Whoops fix a minor makefile dependency error
modules/Makefile didn't include the dependency information for modules/extra/*


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1608 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 21:12:44 +00:00
psychon
2525b15357 Remove unused class CNoCopy and CSafePtr
They aren't used anywhere and IMHO they are pretty useless, too.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1607 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 21:09:37 +00:00
psychon
658e529c96 Import most of znc-extra
This imports all modules from znc-extra except modtcl under modules/extra.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1606 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 19:54:27 +00:00