Commit Graph

173 Commits

Author SHA1 Message Date
Daniel Folkinshteyn 18ec61842c Secure some more commands which take a regexp from untrusted user input.
Namely todo.search, note.search, dunno.search.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-20 15:06:43 -04:00
Valentin Lorentz d3da0c2efc commands.py: Add 'channelOrGlobal' converter. 2012-10-18 19:30:35 +02:00
Daniel Folkinshteyn 6a9af819a3 src/commands.py: make subprocesses raise an error on timeout, rather than return a string
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 22:14:15 -04:00
Daniel Folkinshteyn 9fc7ec28b4 Fix error handling for subprocesses.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:44:04 -04:00
Daniel Folkinshteyn 141b120a9c commands.process: return immediately when terminating process, without having to deal with the queue.
otherwise, we have to block for $smalldelay between putting and getting the item, since queue putting is not instantaneous
and sometimes we would get 'nothing returned' instead of the timeout message.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:32:54 -04:00
Daniel Folkinshteyn 7f98aa7105 Some improvements to the commands.process function - better process naming and informational output.
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:28:41 -04:00
Daniel Folkinshteyn a2985c37d6 Create a commands.process function which runs a function inside a separate process.
This is the only way to limit the execution time of a possibly long-running python statement.
Use this on String.re, due to the possibility of pathologically long re matching in python.
This allows us to remove the 'trusted-only' restriction on string.re.
In the future, this should probably be used in other places that take user-supplied regexps,
such as 'misc last --regexp', for example, as well as other potentially long-running tasks
that can block the bot.

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-10-15 21:19:34 -04:00
James McCoy cef93a6cfd Use relative imports for all packages under the supybot namespace
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-09-17 22:12:11 -04:00
James McCoy 82ecf36fcd Update my name/contact information
Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
2012-09-01 10:16:48 -04:00
Valentin Lorentz 82fdc2dda3 core: Internationalize some strings & update l10n-fr & change translation for 'is not a valid %s'. 2012-07-30 11:35:44 +02:00
skizzhg 977f3f5110 Fix typoes in core. 2012-04-23 21:55:21 +02:00
Valentin Lorentz 570e30f1b7 Pass supybot.protocols.irc.strictRfc to ircutils.isNick in 'nick' converter. Closes GH-312. 2012-02-11 09:03:52 +01:00
Daniel Folkinshteyn 37597bfe94 Create a commands.process function which runs a function inside a separate process.
This is the only way to limit the execution time of a possibly long-running python statement.
Use this on String.re, due to the possibility of pathologically long re matching in python.
This allows us to remove the 'trusted-only' restriction on string.re.
In the future, this should probably be used in other places that take user-supplied regexps,
such as 'misc last --regexp', for example, as well as other potentially long-running tasks
that can block the bot.

Conflicts:

	plugins/String/plugin.py
	src/commands.py
2011-08-15 17:24:33 +02:00
Daniel Folkinshteyn 3fa45b3b5f Secure some more commands which take a regexp from untrusted user input.
Namely todo.search, note.search, dunno.search.

Conflicts:

	plugins/Note/plugin.py
	plugins/Todo/plugin.py
	src/version.py
2011-08-13 01:59:18 +02:00
Daniel Folkinshteyn 3526d5dabf src/commands.py: make subprocesses raise an error on timeout, rather than return a string
Conflicts:

	src/commands.py
2011-08-13 01:53:58 +02:00
Valentin Lorentz 4ebcda024b Bug fix (I didn't test the previous commit correctly) 2011-07-01 16:11:37 +02:00
Valentin Lorentz 41514bafdd Core & Channel & Topic: Add the isGranted converter. Closes GH-39. 2011-07-01 15:58:39 +02:00
Valentin Lorentz 32b21cbc18 Add a clue in solving issue with wrapping wrapped commands 2011-03-01 08:47:53 +01:00
Valentin Lorentz e8814fc07a Add checkCapabilityButIgnoreOwner converter 2011-01-27 19:32:43 +01:00
Valentin Lorentz e705d3b5a9 Fix name conflict with _() 2011-01-26 10:01:58 +01:00
Valentin Lorentz 0998c2a43f Fix bug in src/commands.py (forgotten comma) 2010-11-14 14:36:02 +01:00
Valentin Lorentz 6b26861c23 Internationalize callbacks.py, commands.py, and conf.py ; and generated the messages.pot 2010-10-20 18:27:58 +02:00
James Vega 288d7c6e02 Update plugins to ignore all non-ACTION CTCP messages.
Also update commands.urlSnarfer to do the same, which allows us to revert
"Don't bother snarfing URLs from non-Action CTCP messages."

This reverts commit 3282e3407e.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2010-01-28 08:14:44 -05:00
James Vega 8a98653d3b Allow Banmask.makeBanmask to work when dynamic.channel is None.
This gives back the ability to generate a banmask based on the global banmask
settings instead of per-channel settings.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-11-01 10:26:08 -05:00
James Vega 56fbbe9f36 commands.py: Explain the odd userHostmask check in getOtherUser
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-23 18:29:49 -04:00
James Vega 459bc616b1 Reply with an error when getBanmask doesn't have a valid channel.
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-02 07:40:33 -04:00
James Vega 260570bd4f Ensure getBanmask has a channel variable as per makeBanmask's requirement
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-09-01 23:29:42 -04:00
Štěpán Němec 2fa0f6dedc commands.py: Sort the items of the wrappers dictionary
(just to make it readable)

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
2009-08-20 11:20:48 -04:00
James Vega abb83d4863 Make getBanmask use protocols.irc.banmask.makeBanmask 2009-03-11 13:37:27 -04:00
Jeremy Fincher d08eee8f13 Made httpUrl arg wrapper add http:// if that produces a valid http url. 2009-03-11 13:37:25 -04:00
James Vega 2f15eb2418 getHaveOp needs to call getChannel if state.channel isn't set 2009-03-11 13:37:25 -04:00
James Vega a3e4fc5b1d Change the modeline to use softtabstop instead of tabstop. 2006-02-11 15:52:51 +00:00
James Vega 17afef9c30 src/commands: Change the rest context so that it raises an IndexError when no arguments are available.
This fixes the problem in Dunno (and any other plugin that uses plugins.ChannelIdDatabasePlugin) where calling the search command using only the getopts and no additional arguments will cause the command to fail and the help to be displayed.
2005-07-27 21:57:17 +00:00
James Vega e4c9381f7b src/commands: Update first so that state.errored will not prevent the bot from responding when the first converter fails. 2005-06-13 17:27:15 +00:00
Jeremy Fincher 4da1f38235 Fixed the security issue nicktastic reported, and made sure that if, for some reason, an error doesn't raise an exception, it still stops the calling of the command function. 2005-06-01 20:13:33 +00:00
Jeremy Fincher c1dcb47e3f Added another elucidating comment. 2005-05-30 19:20:17 +00:00
Jeremy Fincher 0b848199b5 Fixed some style issues with logging calls. 2005-05-18 04:18:35 +00:00
James Vega 994cff5c05 Update a couple missed changeFunctionName calls. 2005-05-16 03:25:43 +00:00
Jeremy Fincher 2394005cdd Moved utils.changeFunctionName to utils.python. 2005-05-15 17:17:26 +00:00
James Vega 9971e991fe Fix the modelines. 2005-03-23 20:07:45 +00:00
James Vega aefcd594df Move structures to utils/ 2005-03-12 18:01:47 +00:00
Jeremy Fincher fc2a18bdb3 Added a name= keyword argument for commands.wrap, to override the name of the method being wrapped. 2005-02-28 07:58:46 +00:00
Jeremy Fincher 4648360a04 Added op, halfop, and voice converters, and converted Channel to use them. 2005-02-24 09:59:21 +00:00
Jeremy Fincher 07814fc808 Fix for bug in first.__repr__. 2005-02-21 01:04:45 +00:00
Jeremy Fincher 156084c225 Fixed some bugs introduced with the latest refactoring of callCommand, etc. 2005-02-17 22:39:44 +00:00
James Vega 90c000793d utils.gen.* functions shouldn't explicitly be called since they're all in the utils namespace. 2005-02-15 13:57:57 +00:00
Jeremy Fincher e53e237818 Better error logging for when commands.wrap fails to provide the right number of arguments. 2005-02-07 01:04:33 +00:00
Jeremy Fincher 978cf65453 Added an email converter. 2005-02-01 07:08:13 +00:00
James Vega 28cb5abc65 Update usage of functions in utils.gen. 2005-01-31 13:06:43 +00:00
Jeremy Fincher 70da904be2 States don't have a copy method. 2005-01-29 21:23:37 +00:00
James Vega 6f2aec352a Fix a bug where nickInChannel would add the channel to the args list. 2005-01-28 22:53:59 +00:00
Jeremy Fincher e1fe232e9b Converted commands.py to use the new utils.web instead of webutils; fixed a bug in the httpUrl converter which rejected https protocols. 2005-01-28 14:51:25 +00:00
Jeremy Fincher 5fd6bbb52d Completely restructured our utils modules.
Tons of changes.  Here's the summary of things that matter most:

* There is no more supybot.fix.
* There is no more supybot.webutils; now there is supybot.utils.web.
  * It's no longer webutils.WebError, but just utils.web.Error.
* You shouldn't import itertools, ideally, but instead import utils.iter.
* No more using imap/ifilter in commands unless absolutely necessary.  It's
  premature optimization and annoying.
* utils.str.format isn't quite ready yet, but will be soon.  That'll be the
  next big thing to fix in our code.
2005-01-27 06:59:08 +00:00
Jeremy Fincher 5019d10a1b Updated license years. 2005-01-19 13:33:05 +00:00
Jeremy Fincher 8ca625d339 Initial import. 2005-01-19 13:14:38 +00:00
James Vega dbfec8afb9 Add supybot module 2007-04-22 20:10:26 +00:00
James Vega 88a906df84 Fix a bug where nickInChannel would append channel to the args list. 2005-01-28 22:59:27 +00:00
James Vega 225c565aee Add/update supybot.databases.plugins.channelSpecific{,.link{,.allow}}
channelSpecific.link replaces channelSpecific.channel
2005-01-08 07:22:46 +00:00
James Vega d97a652182 Need to actually add the channel to state.args if getChannel throws an exception 2005-01-02 02:34:54 +00:00
Jeremy Fincher b9067089b1 Removed an XXX. 2004-12-16 09:30:45 +00:00
James Vega cedd6a2b59 Add some Raise=True and a test for multiple replies from Misc.hostmask. 2004-12-15 17:54:33 +00:00
Jeremy Fincher af1d04291d Reimplementation of channeldb converter, respecting the channelValueness of supybot.databases.plugins.channelSpecific, and turned supybot.databases.plugins.channelSpecific.channel into a channelValue so channels can link their databases to other channels. 2004-12-13 06:18:41 +00:00
Jeremy Fincher 1a63af3b26 Fix for bug #1081086. Be sure to read the reasoning in the bug itself. 2004-12-08 06:16:08 +00:00
Jeremy Fincher 640241bd11 Added networkIrc, owner, admin. 2004-12-07 06:39:52 +00:00
James Vega 864fd97315 Fix a getNick bug 2004-12-03 02:54:27 +00:00
James Vega a71d074e46 cleaner implementation of getLong 2004-11-30 18:12:43 +00:00
James Vega c87788dc62 Make sure state.channel is carried over when we call State.essence. Also,
add continueOnError option to any().
2004-11-30 05:15:41 +00:00
Jeremy Fincher b1d1991873 Converted to new method. 2004-11-30 04:47:21 +00:00
Jeremy Fincher 65b369ffd4 Removed a vestigial comment; our current system of not combiningRest has worked out well. 2004-11-30 04:41:43 +00:00
James Vega 7eed44eef7 Converted Random to wrap. Added a long converter to assist this. 2004-11-28 02:23:59 +00:00
Jeremy Fincher de367731f1 Fixed some bugz0rs. 2004-11-21 13:18:58 +00:00
Jeremy Fincher ed2488c1f8 Converted Alias to use commands.wrap (for the most part). 2004-11-11 16:37:47 +00:00
Jeremy Fincher d280387518 rest should require args unless indicated otherwise. Currently, we can't indicate otherwise, but that's because we haven't had a need for it yet. 2004-11-08 20:51:39 +00:00
Jeremy Fincher 60966044b1 This should allow contexts where we allow converters. 2004-10-28 17:08:23 +00:00
Jeremy Fincher 72a7a22d4e Fixed a bug in getId and added a debug log to Spec.__call__. 2004-10-27 07:50:47 +00:00
James Vega bc23a69406 You shall not delete ME! 2004-10-27 01:19:39 +00:00
Jeremy Fincher ba1bb34729 Allow abbreviation in getLiteral. 2004-10-26 23:17:58 +00:00
Jeremy Fincher 49019308d7 Fixed getOtherUser. 2004-10-26 21:01:05 +00:00
Jeremy Fincher b32215e169 Tons of updates, text now snarfs all remaining, but we still haven't stopped combining rest in context. 2004-10-26 20:49:20 +00:00
James Vega a1b7b670fb getOtherUser shouldn't accept a hostmask (re: bug #1054680) 2004-10-26 18:32:11 +00:00
James Vega cbd5abbab7 A bunch more %r -> %s conversions as well as wrap updates, new policy for
Channel.voice and some bug fixes for Debian
2004-10-25 22:59:03 +00:00
Jeremy Fincher d0e2f2da31 Fixed. 2004-10-24 07:35:45 +00:00
James Vega c0a8f5e45d commands.reversed => commands.reverse 2004-10-24 03:53:56 +00:00
James Vega 4dafdcdd57 Massive updates. %r -> %s, some commands.wrap updates. Factoids is broke
until we get some stuff working in commands.py
2004-10-23 22:07:50 +00:00
Jeremy Fincher 1a6b4aaa95 Removed an old comment that wouldn't ever work. 2004-10-23 21:22:55 +00:00
Jeremy Fincher 1a73603e22 Added httpUrl converter. 2004-10-23 20:54:28 +00:00
Jeremy Fincher e3bdd34f3f Allow ids to have # in front of them. 2004-10-23 20:32:29 +00:00
Jeremy Fincher 410569708c Fixed bugz0r. 2004-10-22 19:50:32 +00:00
Jeremy Fincher c943ab77bb Made commands.wrap stop doing decorators, exposed thread and urlSnarfer, and changed plugins accordingly. 2004-10-22 05:56:55 +00:00
Jeremy Fincher 2179548da9 Added an XXX. 2004-10-19 16:43:09 +00:00
Jeremy Fincher 803997ee78 Somehow the p-testing was removed. 2004-10-19 12:13:41 +00:00
Jeremy Fincher e960bad9d1 Fixed #1049958. 2004-10-19 12:01:33 +00:00
Jeremy Fincher eb5531034c Handle properly state.allowExtra in context. 2004-10-19 11:56:34 +00:00
Jeremy Fincher 9d0fa5e3ff Changed callerInChannel to callerInGivenChannel; added nickInChannel, added matches, and raised a subclass of KeyError from getConverter so we get prettier tracebacks. 2004-10-19 03:10:58 +00:00
Jeremy Fincher 6d62500a07 Allow wrappers to set the allowExtra value. 2004-10-19 01:43:58 +00:00
Jeremy Fincher edc1e70648 Fixed empty types. 2004-10-15 11:18:55 +00:00
Jeremy Fincher e720f46a5a Not completely working, but tests pass (for what's expected to pass). 2004-10-14 08:41:08 +00:00
James Vega 85780543aa Add some (hopefully) elucidating comments. If anyone (*cough*jemfinch*cough)
thinks they are ambiguous or could be better worded, please adjust.
2004-10-13 14:57:25 +00:00
James Vega aeed361d4c We actually want the state that the spec call gives us. Also, let's check
whether our default is callable and return the value of calling it, if so.
2004-10-13 14:37:52 +00:00
Jeremy Fincher 477ec6ead7 Fix0red the failure. 2004-10-12 11:58:08 +00:00