Commit Graph

1611 Commits

Author SHA1 Message Date
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
psychon 53f2bb456a 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 2bdad793c0 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 af5f7a1489 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 1430cd3659 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 570946624c 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 7dfa081daa 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 c26141647b 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 4415e53001 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 fc7c67f148 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 8d0e2556d3 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 7f182a9bbb 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 c92cea6b87 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 6bdd7b0feb 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 49b48b05b1 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 98e352bf4b 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 fc4c3b974b 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
psychon a593f584c0 Add support for extra modules
This commits adds the necessary build system fun for extra modules in
modules/extra which can be enabled with --enable-extra.

This is a preparation for the import of znc-extra.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1605 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 19:49:21 +00:00
psychon fd762125b0 Regenerate configure with newer autoconf
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1604 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 19:22:22 +00:00
psychon 0ee2fd7507 Fix a division by zero bug
Thanks to Sickness for reporting this and providing backtraces and for flakes
for writing a first patch that Sickness tested.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1603 726aef4b-f618-498e-8847-2d620e286838
2009-08-20 17:01:33 +00:00
psychon aacb639b3b JoinChans(): Join channels in a semi random number
Now ZNC doesn't try to join the first, then the second etc channel, but instead
it will start at a random channel and go on from there.

This fixes a bug if you got e.g. MaxJoins = 5 and your first five channels are
invite-only. Without this, ZNC would never try to join any of the other
channels. With this patch applied, it will sooner or later try to join the other
channels, too. (I'd guess more sooner than later)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1602 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 20:00:09 +00:00
psychon be806170b8 Split up CUser::JoinChans()
This adds CUser::JoinChan() as a helper function


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1601 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 18:49:39 +00:00
psychon 6db23367be route_replies: Don't route 250
/lusers can cause a 250 "Highest connection count" reply, but sadly some IRC
daemons don't send this numeric. Since there is no easy way to handle this, we
will just assume that 266 is the last numeric reply to /lusers.

*If* there is a 250 reply, it will be broadcasted to all connected clients. This
is still better than the "This module hit a timeout" we generate on some ircds
currently.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1600 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 18:01:59 +00:00
psychon dbcf9b4649 Some minor fixup to AUTHORS
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1599 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 17:57:21 +00:00
psychon ca2beaffb6 route_replies: Generic "not enough arguments" support
This teaches route_replies how to parse 461 numerics to find out which command
caused them. This way we don't have to add this numeric to all the requests we
route by hand.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1598 726aef4b-f618-498e-8847-2d620e286838
2009-08-17 17:56:26 +00:00
psychon 11e360cb15 Fix unloading of /bin/rm'd modules
The old code first tried to dlopen() the module again to find out if it's a
global or a user module. This could have lots of weird effects.

Now we just unload the user module and if that fails retry with the global
module (if the user got the appropriate privileges).

This removes and fixes the #warning added in the last commit.

P.S.: Oh and this is less LOCs now!


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1597 726aef4b-f618-498e-8847-2d620e286838
2009-08-10 19:17:33 +00:00
psychon 9cb435be58 Improve the error message from /msg *status loadmod
Ever since r1505 our error messages when loading modules all were the same:
"Unable to find modinfo"

Improve this by giving the user all the information we offered before again. The
most useful one here is most likely the result from dlerror(). This is done by
adding a helper function CModules::OpenModule(). Most of its code is from
CModules::LoadModule() and this function and CModules::GetModInfo() now both use
this helper function for generating error messages.

This commit adds a "#warning", don't worry I'm working on it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1596 726aef4b-f618-498e-8847-2d620e286838
2009-08-10 18:58:55 +00:00
psychon 8e4fbad60d Import the adminlog module znc-extra
This module logs events like failed and successful logins and IRC disconnects to
a log file and/or syslog.

Original module author is SilverLeo, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1595 726aef4b-f618-498e-8847-2d620e286838
2009-08-10 18:16:03 +00:00
psychon cc85e00d56 Import the route_replies module from znc-extra
This module fixes some issues if multiple clients are connected to the same ZNC
user. ZNC itself would send replies to e.g. /who to all connected clients and
this modules makes the reply go to the client which sent the request.

Thanks to SilverLeo, tomaw and Vadtec for finding missing numerics.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1594 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:36:31 +00:00
psychon 8f8a3bff34 Import the autoreply module from znc-extra
This module automatically replies to queries and private notices if no user is
connected to ZNC.

Svedrin submitted an initial version of this module, but due to my own
stupidness I later rewrote it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1593 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:33:29 +00:00
psychon e2e9b74feb Import the buffextras module from znc-extra
This module adds topic changes, nick changes, parts, joins, quits, kicks and
mode changes to the buffer playback.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1592 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:29:43 +00:00
psychon 849c41a49b Import the fixfreenode module from znc-extra
Thanks to tomaw for the additional identify-ctcp "support"


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1591 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:28:12 +00:00
psychon 3924f8f0cf Fix some comment that I recently committed
Thanks to KiNgMaR.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1590 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:17:04 +00:00
psychon 92f78bc632 Update config.guess and config.sub
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1589 726aef4b-f618-498e-8847-2d620e286838
2009-08-07 19:15:35 +00:00
psychon 273b21bd35 Fix VHost and MOTD input box in graphiX and dark-clouds
They squashed everything into one line which obviously is not good.

Thanks to flakes for the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1588 726aef4b-f618-498e-8847-2d620e286838
2009-08-06 20:46:42 +00:00
psychon 55d5173ca4 Enable large file support in configure if possible
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1587 726aef4b-f618-498e-8847-2d620e286838
2009-08-05 19:36:13 +00:00
psychon de8799e754 Fix a crash bug if c-ares is enabled
CSocket sometimes calls our select() wrapper with writeds == NULL and we didn't
handle this case at all which lead to a NULL pointer dereference.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1586 726aef4b-f618-498e-8847-2d620e286838
2009-08-05 19:35:09 +00:00
psychon 1d0c5fabb3 Fix some startup error messages
We should *never* use exit(0); on error and it doesn't hurt if our error
messages use a similar wording.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1585 726aef4b-f618-498e-8847-2d620e286838
2009-08-01 09:06:20 +00:00
psychon 3cf223c49b Send a correct MODE to new clients
The source of commands is supposed to be a complete nick mask, but we only used
the nick.

Thanks to flakes for (kinda) noticing this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1584 726aef4b-f618-498e-8847-2d620e286838
2009-08-01 09:03:29 +00:00
psychon d8c9de8aa8 Send a "remove all user mode" MODE to clients when we lose the irc connections
Without this we could cause a client desync (ZNC still got the correct
information).

Bug reported by tomaw and patch provided by flakes, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1583 726aef4b-f618-498e-8847-2d620e286838
2009-08-01 08:59:06 +00:00
psychon 839cb42f50 Use @PACKAGE_VERSION@ instead of @VERSION@
autoconf automatically substitutes @PACKAGE_VERSION@, so there is not much point
into adding another substitute for this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1582 726aef4b-f618-498e-8847-2d620e286838
2009-07-26 19:38:57 +00:00
psychon 912b18a289 Two small fixes to the makefiles
- The last commit broke windows (= everything which uses libznc)
  (sorry, copy&paste error)
- distclean left the .pc files behind


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1581 726aef4b-f618-498e-8847-2d620e286838
2009-07-26 16:16:48 +00:00
psychon 958d9cff8d Add "make uninstall" target
(And some minor fixes to "make install")


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1580 726aef4b-f618-498e-8847-2d620e286838
2009-07-26 15:04:59 +00:00