nakedmudv3.6/
nakedmudv3.6/lib/
nakedmudv3.6/lib/help/A/
nakedmudv3.6/lib/help/B/
nakedmudv3.6/lib/help/C/
nakedmudv3.6/lib/help/D/
nakedmudv3.6/lib/help/G/
nakedmudv3.6/lib/help/H/
nakedmudv3.6/lib/help/J/
nakedmudv3.6/lib/help/L/
nakedmudv3.6/lib/help/M/
nakedmudv3.6/lib/help/O/
nakedmudv3.6/lib/help/P/
nakedmudv3.6/lib/help/R/
nakedmudv3.6/lib/help/S/
nakedmudv3.6/lib/help/W/
nakedmudv3.6/lib/logs/
nakedmudv3.6/lib/misc/
nakedmudv3.6/lib/players/
nakedmudv3.6/lib/txt/
nakedmudv3.6/lib/world/
nakedmudv3.6/lib/world/examples/
nakedmudv3.6/lib/world/examples/mproto/
nakedmudv3.6/lib/world/examples/oproto/
nakedmudv3.6/lib/world/examples/reset/
nakedmudv3.6/lib/world/examples/rproto/
nakedmudv3.6/lib/world/examples/trigger/
nakedmudv3.6/lib/world/limbo/
nakedmudv3.6/lib/world/limbo/room/
nakedmudv3.6/lib/world/limbo/rproto/
nakedmudv3.6/src/alias/
nakedmudv3.6/src/dyn_vars/
nakedmudv3.6/src/editor/
nakedmudv3.6/src/example_module/
nakedmudv3.6/src/help2/
nakedmudv3.6/src/set_val/
nakedmudv3.6/src/socials/
nakedmudv3.6/src/time/
################################################################################
#
# __restricted_builtin_funcs__.py
#
# This contains functions used by __restricted_builtin__ to do certain
# potentially dangerous actions in a safe mode
#
################################################################################
import __builtin__

def r_import(name, globals = {}, locals = {}, fromlist = []):
    '''Restricted __import__ only allows importing of specific modules'''

    ok_modules = ("mud", "obj", "char", "room", "exit", "account", "mudsock",
                  "event", "action", "random", "traceback",
                  "__restricted_builtin__")
    if name not in ok_modules:
        raise ImportError, "Untrusted module, %s" % name
    return __builtin__.__import__(name, globals, locals, fromlist)

def r_open(file, mode = "r", buf = -1):
    if mode not in ('r', 'rb'):
        raise IOError, "can't open files for writing in restricted mode"
    return open(file, mode, buf)

def r_exec(code):
    """exec is disabled in restricted mode"""
    raise NotImplementedError,"execution of code is disabled"

def r_eval(code):
    """eval is disabled in restricted mode"""
    raise NotImplementedError,"evaluating code is disabled"

def r_execfile(file):
    """executing files is disabled in restricted mode"""
    raise NotImplementedError,"executing files is disabled"

def r_reload(module):
    """reloading modules is disabled in restricted mode"""
    raise NotImplementedError, "reloading modules is disabled"

def r_unload(module):
    """unloading modules is disabled in restricted mode"""
    raise NotImplementedError, "unloading modules is disabled"