os.execve(pth,args,env) and os.chroot(pth) = problems

Donn Cave donn at u.washington.edu
Tue Mar 7 14:26:39 EST 2006


In article <1141751079.504570.75980 at j52g2000cwj.googlegroups.com>,
 "goodnamesalltaken at gmail.com" <goodnamesalltaken at gmail.com> wrote:

> ...  It seems me that the os.chroot() call is messing up the
> os.execve() (which executes the cgi script).  os.execve(pth, args,
> envVariables) is only executed if os.path.exists(pth) returns True.
> But when I run a CGI script that os.path.exists(pth) returns True for,
> then os.execve(pth) python throws back the error:
> 
> File "/***/***/***/Unpriv.py", line 201, in execCGI
> OSError: [Errno 2] No such file or directory
> 
> However I don't see how this is possible if os.path.exists(pth) returns
> True, why is it os.execve() has problems finding it.

I haven't used chroot enough to know all the pitfalls, but
here's one guess:  suppose the CGI script file `pth' might
actually be a script, with a `#!' top line that points to
an interpreter that isn't there, in your chroot space?

   Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list