rexec works strange...

Oleg Broytmann phd at phd.fep.ru
Wed Jun 20 06:44:24 EDT 2001


   (Ivan, please note - I am replying into the newsgroup, too)

On Wed, 20 Jun 2001, Oleg Broytmann wrote:
> On Wed, 20 Jun 2001, Ivan Ivanov wrote:
> > Thank you for the help, I'll try to figure out how
> > to do the first suggestion - disallow importing sys.
> > This seems to be a good idea, I just don't know
> > how to do it. Do you have better insight?

   Found it: it is the code

ok_sys_names = ('ps1', 'ps2', 'copyright', 'version',
                'platform', 'exit', 'maxint')

   To disallow sys.exit remove exit from the list. To do it in Python way:

1. Create a class like

def MyRExec(rexec.RExec):
   ...

2. In this class define your list:

def MyRExec(rexec.RExec):
   ok_sys_names = ('ps1', 'ps2', 'copyright', 'version',
                   'platform', 'maxint')

   Use the class instead of standard RExec.

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list