Commit Graph

539 Commits

Author SHA1 Message Date
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
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 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 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 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 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 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 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 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 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 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 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
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 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 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 39364f057f Add a "swap" command to perform to change the order of commands
Patch by KiNgMaR, thanks.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1560 726aef4b-f618-498e-8847-2d620e286838
2009-07-08 20:17:47 +00:00
psychon 338e52af9c Add /msg *perform execute
This command lets perform send the perform lines now. This can be useful for
testing.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1558 726aef4b-f618-498e-8847-2d620e286838
2009-07-06 16:36:03 +00:00
psychon 79a80cefb2 I suck (I broke the build!)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1555 726aef4b-f618-498e-8847-2d620e286838
2009-07-01 09:11:33 +00:00
psychon d3b95a0b3d Nickserv: Add a clear command
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1554 726aef4b-f618-498e-8847-2d620e286838
2009-07-01 09:06:29 +00:00
psychon 442aee2baf Add and use CZNCSock instead of Csock everywhere
This class will be used to implement async DNS in a later commit.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1550 726aef4b-f618-498e-8847-2d620e286838
2009-06-29 11:26:19 +00:00
psychon 5678220d34 Remove some useless casts
Classes derived from Csock* can be casted implicitly to their base class, this
explicit casts are rather pointless.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1548 726aef4b-f618-498e-8847-2d620e286838
2009-06-26 18:13:40 +00:00
sebastinas af13278f4f made string, boolean and integer static
Made string, boolean and integer in PrintHelp static sinve vars
is static too.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1542 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 19:16:20 +00:00
psychon 220aab468d admin: Require a username argument
This patch makes set, setchan and addserver require a username argument.
(One can just use $me)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1541 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 14:41:50 +00:00
psychon 87a7672638 I fail (fix the admin module)
Thanks SilverLeo :(


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1540 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 12:21:37 +00:00
psychon 062989595c Admin: Some minor cleanup
Move some code from GetUser()'s callers into GetUser() itself.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1539 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 11:40:14 +00:00
prozacx c4a6f39b53 Pulled in CString changes from my common repository to help facilitate the upcoming webmods changes
Changes include...

- CString -
Addition of LCString typedef to list<CString>

Added four more args to CString::Token()...
	bool bAllowEmpty = false        <-- This default of false is NOT backward compatible but seems way more intuitive
	const CString& sLeft = ""
	const CString& sRight = ""
	bool bTrimQuotes = true

Added CString::OptionSplit()
Added CString::QuoteSplit()

Added two new args to CString::Split()...
	bool bTrimQuotes = true,
	bool bTrimWhiteSpace = false

- CTemplate -
Added new class CTemplateTagHandler to provide capability to add custom tags and vars
Added var name pointer dereferencing in the form of <? VAR Name=*other_var ?> (use ** to start with a literal star)
Added a list of paths that can be used to look for a given filename in multiple locations
Added CTemplate::PrependPath()
Added CTemplate::AppendPath()
Added CTemplate::RemovePath()
Added CTemplate::ClearPath()
Added CTemplate::PrintString() for filling a CString& instead of a stream
Added <? LT ?> which outputs a literal "<?"
Added <? GT ?> which outputs a literal "?>"
Added <? SETBLOCK ?> and <? ENDSETBLOCK ?> for setting a variable's value to the contents between the tags
Added <? EXPAND ?> for expanding a filename to a path using the settable list of paths
Added <? BREAK ?> and <? CONTINUE ?> inner loop tags
Added <? EXIT ?> tag to stop processing
Added <? DEBUG ?> tag for printing to DEBUG()
Added REVERSE keyword to the <? LOOP ?> tag



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1537 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 05:48:12 +00:00
psychon 2206e19ad2 admin: Add set/get Nick/Altnick to help
Dunno why these commands weren't documented before...


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1535 726aef4b-f618-498e-8847-2d620e286838
2009-06-06 18:09:07 +00:00
psychon 9c1f2ee462 stickychan: Accept a channel list as module arguments
If you now load stickychan with "#chan1,#chan2 bla" as its argument, both
channels are stuck where "bla" is the channel key for #chan2.

Thanks to FB-eYe for the suggestion.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1534 726aef4b-f618-498e-8847-2d620e286838
2009-06-05 19:56:23 +00:00
psychon aa4425bda5 Fix webadmin favicons
r1481 moved the /img/ subdir into /data/, but forgot to fix the path which
is used for the favicon, which meant we generated a 404 for the favicon.
Fix this by using the correct path and everyone is happy again.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1524 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 10:59:36 +00:00
psychon 4e31d49209 CAuthBase: Use a Csock* instead of a CString "sRemoteIP"
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1511 726aef4b-f618-498e-8847-2d620e286838
2009-05-20 09:30:19 +00:00
silverleo 70b28b9ae5 Fix for the new OFTC syntax "authenticate yourself to services with the IDENTIFY command."
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1502 726aef4b-f618-498e-8847-2d620e286838
2009-05-02 12:48:13 +00:00
psychon 9f1f8950f8 Fix crash bug in stickychan
When you are already in #znc and you did 'stick znc' (# prefix missing!),
stickychan caused segfaults or different weird behavior. This happened because
stickychan didn't handle errors from CUser::AddChan(). AddChan() can only error
out if the channel already exists, but since stickychan already checked this,
were does the error come from?
CChan's constructor does some sanity checks on the channel name. It
automatically adds the proper channel prefix (most likely #) if it's missing.
This means when stickychan checked for the channel "znc" it correctly didn't
find one. When it then tried to add "znc", it really tried adding "#znc" which
could fail if the channel was already added.

Thanks to DM8Mydog for finding this.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1500 726aef4b-f618-498e-8847-2d620e286838
2009-04-27 18:56:03 +00:00
psychon dfd95078dd modperl also needs -Wno-missing-declarations
Now ZNC compiles with -Wmissing-declarations :)
(BTW I hate the perl headers, could some fix them app so that they cause
less warnings?)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1499 726aef4b-f618-498e-8847-2d620e286838
2009-04-26 10:14:42 +00:00
psychon c4972caafe fail2ban: Add number of allowed failed logins
This adds a new, second argument to fail2ban which is the number of failed
logins one is allowed before being banned. Each login attempt resets the
timeout. This value defaults to 2.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1489 726aef4b-f618-498e-8847-2d620e286838
2009-04-11 20:06:13 +00:00
psychon 424e6c1820 partyline: Fix the KICK sent for deleted users
Before this, the KICK message was missing a target which was kicked.
Now the user kicks himself. :)

Thanks to JoeK for reporting this bug.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1486 726aef4b-f618-498e-8847-2d620e286838
2009-04-09 08:22:20 +00:00
psychon 2f64dffee3 Partyline: Add defines for the used channel prefix
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1485 726aef4b-f618-498e-8847-2d620e286838
2009-04-07 16:14:14 +00:00