Commit Graph

1595 Commits

Author SHA1 Message Date
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
psychon
0b7576a474 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
dbc1fede3d 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
8307d81c56 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
88897381da 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
6782ba987e 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
8cc6b19bca 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
279f5186c6 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
8e4a752f84 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
411373307f 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
f680f242ff 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
7efd863063 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
f478df3ecf 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
4e18ebf07a 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
75a342304c 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
046c4ac5b5 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
8366b461e1 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
c45c31bef4 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
5abf6b9c05 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
2d0f451097 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
f8c78f83ef 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
4fd1b09f7f 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
4a7ab43aad 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
22bc2a6fa1 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
16372a5830 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
73ba048852 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
bec752077b 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
psychon
94f64333ca Fix a bug if a user uses /version
/version generates a 005 server reply. We used to cache this reply in the raw
buffer and the next user who logs in then received the same 005 reply multiple
times.

We fix this by adding CBuffer::UpdateExactLine() which does nothing if the exact
same line is already in the buffer. The only place where we (currently?) use
this is the raw 005 reply.

This should fix sf bug #2817124.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1579 726aef4b-f618-498e-8847-2d620e286838
2009-07-25 22:31:11 +00:00
psychon
7c1689db7c Increase the version number to 0.075
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1578 726aef4b-f618-498e-8847-2d620e286838
2009-07-23 16:59:41 +00:00
psychon
a684891599 Increase the version number to 0.074
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1576 726aef4b-f618-498e-8847-2d620e286838
2009-07-23 16:56:53 +00:00
psychon
f8178e9bc8 Fix a user-after-free bug
When a user is deleted we didn't properly clean up after it. Active DCC
connections (CDCCBounce and CDCCSock) where left laying around and at some later
point of time they used their CUser* pointer which now pointed to invalid data.

This bug is similar to the one from r1557.

Thanks to cnu, our beloved master of destruction, for finding yet another way to
make ZNC break and for testing the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1575 726aef4b-f618-498e-8847-2d620e286838
2009-07-22 16:54:52 +00:00
psychon
6c1014f200 Fix a webadmin bug which was introduced in r1569
The directory prefix checking which prevents path traversal exploits had a logic
error that made it always fail.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1574 726aef4b-f618-498e-8847-2d620e286838
2009-07-21 21:04:49 +00:00
psychon
e11dbf2290 Increase the version number to 0.073
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1573 726aef4b-f618-498e-8847-2d620e286838
2009-07-21 19:45:05 +00:00
psychon
9f71f301ce Increase the version number to 0.072
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1571 726aef4b-f618-498e-8847-2d620e286838
znc-0.072
2009-07-21 19:42:57 +00:00
psychon
ce4f4c5cf7 Fix a high-impact directory traversal bug
You can upload files to znc via /dcc send *status. The files will be saved in
<datadir>/users/<user>/downloads/. The code for this didn't do any checking on
the file name at all and thus allowed directory traversal attacks by all znc
users (no admin privileges required!).

By exploiting this bug, attackers could e.g. upload a new ssh authorized_keys
file or upload a znc module which lets everyone gain shell access. Anything is
possible.

Again:
ONLY A NORMAL USER ACCOUNT NEEDED, no admin privileges.
THE ATTACKER GOT WRITE ACCESS TO ALL PLACES ZNC GOT WRITE ACCESS TO.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1570 726aef4b-f618-498e-8847-2d620e286838
2009-07-21 18:49:02 +00:00
psychon
c7583c4946 Fix a low impact directory traversal bug
A common pattern for checking directories in ZNC is the following:

	sAbsolutePath = CDir::ChangeDir(sAllowedPath, sFile);
	if (sAbsolutePath.Left(sAllowedPath.length()) != sAllowedPath)
		Error;

But there is a problem: If sAllowedPath doesn't end with a slash, we are
vulnerable to an attack. If e.g. sAllowedPath = "/foo/bar", then
sFile = "../bartender" would result in sAbsolutePath = "/foo/bartender". Since
this path does begin with sAllowedPath, the code allowed it.

There shouldn't be any places where this can be exploited currently, but it is
still a security bug (path traversal).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1569 726aef4b-f618-498e-8847-2d620e286838
2009-07-21 18:36:33 +00:00
psychon
4495a6c2e0 Fix an integer overflow bug in the DCC code
The issue happened if off_t was a signed, 4 byte integer (x86). In this case
(off_t) 0xffffffff is -1 and a file size is always larger than -1 which
unconditionally caused the "File too large" error to trigger.

Thanks to [Deton8r] for reporting this bug and flakes for debugging it.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1568 726aef4b-f618-498e-8847-2d620e286838
2009-07-19 19:51:53 +00:00
psychon
dfce94e39f Fix --disable-modules
This was broken since r1561


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1567 726aef4b-f618-498e-8847-2d620e286838
2009-07-18 15:44:32 +00:00
psychon
1105652c1d m4 sucks and autoconf is ugly
For some reason this interpreted some comma as an argument separator and choked
up badly from there on.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1566 726aef4b-f618-498e-8847-2d620e286838
2009-07-17 21:04:41 +00:00
psychon
951382255b Improve the error message if c-ares or pkg-config is not found
This now states more explicitly that c-ares is not strictly required.

Thanks to flakes for noticing that the error messages needs improvement and to
w00t for improving the improved error message flakes and me came up with.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1565 726aef4b-f618-498e-8847-2d620e286838
2009-07-17 20:44:53 +00:00
psychon
1d03b50d73 fail2ban: Clear all bans on rehash
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1564 726aef4b-f618-498e-8847-2d620e286838
2009-07-15 18:28:03 +00:00
psychon
165070019d Add new config option AnonIPLimit
This makes the limit added in r1561 configurable.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1563 726aef4b-f618-498e-8847-2d620e286838
2009-07-12 11:31:49 +00:00
psychon
b03bc3cac9 Make sure OnStatusCommand() is always called when it should be
We didn't call the module hook for commands executed via /znc instead of /msg *status.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1562 726aef4b-f618-498e-8847-2d620e286838
2009-07-11 18:04:25 +00:00
psychon
b25e65dbb6 Add a limit of 10 unidentified connections per IP
Everything which isn't a CClient with a successful login counts as an
unidentified connection in this context. Modules who don't want this kind of
limit on their listening sockets can override CSocket::ConnectionFrom(), but
their sockets will still count towards this limit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1561 726aef4b-f618-498e-8847-2d620e286838
2009-07-10 13:27:55 +00:00