did I miss this before?

This commit is contained in:
age 2007-01-29 23:34:15 +00:00
parent 6d0975d32f
commit 1f24166835
1 changed files with 6 additions and 4 deletions

View File

@ -81,7 +81,7 @@ def checkIfFileIsSafe(fname):
return checkIfFileIsSafe(os.path.dirname(os.path.abspath(fname)))
def checkIfPluginIsValid(plugin):
def checkIfPluginIsValid(plugin):
import imp
try:
x = imp.load_source("cbox_plugin",plugin)
@ -96,7 +96,7 @@ def checkIfPluginIsValid(plugin):
return False
def checkIfEventScriptIsValid(plugin):
def checkIfEventScriptIsValid(plugin):
event_dir = os.path.dirname(plugin)
if os.path.exists(os.path.join(event_dir, EVENT_MARKER)):
return True
@ -112,8 +112,10 @@ def call_plugin(args):
if not os.access(plugin, os.X_OK):
raise Exception, "could not find executable plugin (%s)" % plugin
## check if the plugin (and its parents) are only writeable for root
if not checkIfFileIsSafe(plugin):
raise Exception, "the plugin (%s) is not safe - check its (and its parents') permissions" % plugin
## TODO: this doesn't work with cbx svn versions running by local user
## shouldn't we diable this while developing plugins?
#if not checkIfFileIsSafe(plugin):
#raise Exception, "the plugin (%s) is not safe - check its (and its parents') permissions" % plugin
## check if the plugin is a python program, that is marked as a cryptobox plugin
if not checkIfPluginIsValid(plugin):
raise Exception, "the plugin (%s) is not a correctly marked python script" % plugin