ack! the code i sent works with some simple functions, but not with everything. i'll toy around with it some more, but i'll still have the same question: would it be possible for pymol to save the results of cmd.extend in session files and restore them if security is turned off?

thanks,

-michael

--
www.umich.edu/~mlerner |                        _  |Michael Lerner
This isn't a democracy;| ASCII ribbon campaign ( ) |   Michigan
 it's a cheer-ocracy.  |  - against HTML email  X  |  Biophysics
-Torrence,  Bring It On|                       / \ | mler...@umich

On Mon, 11 Apr 2005, Michael George Lerner wrote:


hi,

i have some scripts that load a bunch of files and do various smart things to make it easy to work with my data. in particular, they define functions and use cmd.extend() to register those functions. the setup takes a long time, and is therefore inconvenient. i'd like to go through it once and save a session file for the future.

i understand that saving commands created by cmd.extend() is a serious security hole. is it serious enough that it's unacceptable even if the user turns the security features off (i.e. "set security,0" or "pymol -o foo.pse")?

for what it's worth, my version of cmd.py now has this right before
"def extend..."

     _extended_commands = {}
     def session_save_extended_commands(session):
        session['extended_commands'] = {}
        for name,function in _extended_commands.iteritems():
           print "SAVING FUNCTION:",name
           session['extended_commands'][name] = function
     def session_restore_extended_commands(session):
        if 'extended_commands' in session:
           for name,function in session['extended_commands'].iteritems():
              if pymol.invocation.options.security:
                 print "NOT RESTORING FUNCTION",name,"FOR SECURITY REASONS"
              else:
                 print "RESTORING FUNCTION:",name
                 extend(name,function)
        return 1
     if session_save_extended_commands not in pymol._session_save_tasks:
        pymol._session_save_tasks.append(session_save_extended_commands)
if session_restore_extended_commands not in pymol._session_restore_tasks:
        pymol._session_restore_tasks.append(session_restore_extended_commands)

and this at the end of the definition of extend:

        _extended_commands[name] = function

it happens that i don't really use cmd.alias() so much, but the same thing should work for saving aliased commands.

thanks,

-michael

--
www.umich.edu/~mlerner |                        _  |Michael Lerner
This isn't a democracy;| ASCII ribbon campaign ( ) |   Michigan
it's a cheer-ocracy.  |  - against HTML email  X  |  Biophysics
-Torrence,  Bring It On|                       / \ | mler...@umich


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users




Reply via email to