From: A.M. K. <aku...@us...> - 2000-10-04 12:38:46
|
Update of /cvsroot/py-howto/pyhowto In directory slayer.i.sourceforge.net:/tmp/cvs-serv3081 Modified Files: rexec.tex Log Message: Code checked with Python 2.0, leading to one change (using pre instead of re) Various minor rewrites Bump version number to 2.0 to match Python's Index: rexec.tex =================================================================== RCS file: /cvsroot/py-howto/pyhowto/rexec.tex,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** rexec.tex 1999/12/09 12:58:18 1.5 --- rexec.tex 2000/10/04 12:38:34 1.6 *************** *** 3,7 **** \title{Restricted Execution HOWTO} ! \release{1.1} \author{A.M. Kuchling} --- 3,7 ---- \title{Restricted Execution HOWTO} ! \release{2.0} \author{A.M. Kuchling} *************** *** 122,126 **** The previous line will cause an \code{ImportError} exception to be raised, with an associated string value that reads "untrusted dynamic ! module: socket". Trying to open a file for writing is also forbidden: \begin{verbatim} --- 122,126 ---- The previous line will cause an \code{ImportError} exception to be raised, with an associated string value that reads "untrusted dynamic ! module: _socket". Trying to open a file for writing is also forbidden: \begin{verbatim} *************** *** 144,153 **** \end{verbatim} ! In general, these are modules that can't affect anything outside of the ! executing code; they allow various forms of computation, but don't allow ! operations that change the filesystem or use network connections to ! other machines. (The \code{pcre} module may be unfamiliar; it's an ! internal module used by the \code{re} module; this means that restricted ! code can still perform regular expression matches.) It also restricts the variables and functions that are available from --- 144,154 ---- \end{verbatim} ! In general, these are modules that can't affect anything outside of ! the executing code; they allow various forms of computation, but don't ! allow operations that change the filesystem or use network connections ! to other machines. (The \code{pcre} module may be unfamiliar. It's ! an internal module used by the \code{pre} module, which is the module ! that should be used by restricted code to perform regular expression ! matches.) It also restricts the variables and functions that are available from *************** *** 237,242 **** \begin{verbatim} >>> class C: ! .... def f(self): print "Hi!" ! .... \end{verbatim} --- 238,243 ---- \begin{verbatim} >>> class C: ! ... def f(self): print "Hi!" ! ... \end{verbatim} *************** *** 287,292 **** doing this, since \code{g} will be executed without restrictions; you have to be sure that \code{g} is a function that can't be used to do ! any damage. (Or an instance with no methods that do anything ! dangerous. Or a module containing no dangerous functions. You get the idea.) --- 288,293 ---- doing this, since \code{g} will be executed without restrictions; you have to be sure that \code{g} is a function that can't be used to do ! any damage. (Or is an instance with no methods that do anything ! dangerous. Or is a module containing no dangerous functions. You get the idea.) *************** *** 297,301 **** raised by restricted code; they'll be propagated up the call stack until a \code{try...except} statement is found that catches it. If ! none is found, the interpreter will print a traceback and exit, which is its usual behaviour. To prevent untrusted code from terminating the program, you should surround calls to \code{r_exec()}, --- 298,302 ---- raised by restricted code; they'll be propagated up the call stack until a \code{try...except} statement is found that catches it. If ! no exception handler is found, the interpreter will print a traceback and exit, which is its usual behaviour. To prevent untrusted code from terminating the program, you should surround calls to \code{r_exec()}, *************** *** 459,463 **** \end{verbatim} ! \section{Customizing the Restricted Environment} Often you'll wish to customize the restricted environment in various --- 460,464 ---- \end{verbatim} ! \subsection{Modifying Built-ins} Often you'll wish to customize the restricted environment in various *************** *** 522,527 **** \end{verbatim} ! Obviously, a less trivial function could import modules using HTTP or ! whatever. \section{References} --- 523,527 ---- \end{verbatim} ! Obviously, a less trivial function could import modules using HTTP, or do something else of interest. \section{References} *************** *** 566,569 **** --- 566,572 ---- Mar. 16, 1998: Made some revisions suggested by Jeff Rush. Some minor changes and clarifications, and a sizable section on exceptions added. + + Oct. 4, 2000: Checked with Python 2.0. Minor rewrites and fixes made. + Version number increased to 2.0. \end{document} |