Update of /cvsroot/webware/Webware/PSP
In directory sc8-pr-cvs1:/tmp/cvs-serv29753/PSP
Modified Files:
ServletWriter.py
Log Message:
Modifying PSP/ServletWriter.py to use mkstemp() instead of mktemp().
mkstemp() was added in Python 2.3 for improved security over mktemp().
Making MiscUtils/Funcs.py simply pull the mktemp and mkstemp from Python
if the version is 2.3 or greater. Otherwise, we define our own versions
of those functions. Note that our mkstemp is not as secure as the one
that comes with Python 2.3.
Index: ServletWriter.py
===================================================================
RCS file: /cvsroot/webware/Webware/PSP/ServletWriter.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** ServletWriter.py 20 Jan 2003 07:17:34 -0000 1.12
--- ServletWriter.py 30 Jan 2003 21:17:58 -0000 1.13
***************
*** 26,30 ****
from Context import *
! from MiscUtils.Funcs import mktemp
import string, os, sys, tempfile
--- 26,30 ----
from Context import *
! from MiscUtils.Funcs import mkstemp
import string, os, sys, tempfile
***************
*** 39,44 ****
def __init__(self,ctxt):
self._pyfilename = ctxt.getPythonFileName()
! self._temp = mktemp('tmp', dir=os.path.dirname(self._pyfilename))
! self._filehandle = open(self._temp,'w+')
self._tabcnt = 0
self._blockcount = 0 # a hack to handle nested blocks of python code
--- 39,44 ----
def __init__(self,ctxt):
self._pyfilename = ctxt.getPythonFileName()
! fd, self._temp = mkstemp('tmp', dir=os.path.dirname(self._pyfilename))
! self._filehandle = os.fdopen(fd, 'w')
self._tabcnt = 0
self._blockcount = 0 # a hack to handle nested blocks of python code
|