Loading ...
Sorry, an error occurred while loading the content.

[PBML] Re: simple example - one system call works, one doesn't

Expand Messages
  • hooyar66
    ... info ... I included $ENV{ PATH } = ( C: WINDOWS system32 ); because many OS . dll files and the Command interpreter reside there, all the other files are
    Message 1 of 6 , Jul 28, 2005
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, "Damien Carbery" <daymobrew@y...
      > wrote:
      > With respect to setting $ENV{'PATH'}, it gets passed to the OS when
      > system() is called. When I create a CGI script I turn on taint
      > checking, delete some env vars (IFS, ENV, BASH_ENV, like above) and
      > set $ENV{'PATH'} to /usr:/usr/bin (or something like this). This
      > is passed to the OS when invoking system commands.

      I included $ENV{'PATH'} = ("C:\\WINDOWS\\system32"); because many OS .
      dll files and the Command interpreter reside there, all the other
      files are in CWD (messy) so that they can be found.

      As I understand it the $ENV{'PATH'} needs to include the location of
      the .exe/.dll's and any other dependent files. Ideally these would
      exist on the 'remote' server - but I then seem to have problems
      related to Network Access, so I need to move the .exe & dependent
      files. to the Webserver's "/usr/bin".

      --- In perl-beginner@yahoogroups.com, Mike Southern <gb1198@c...>
      > So why does is exacta.exe program not work? I had isolated the
      problem as
      > either a) couldn't find DLLS (wrong), b) environment not set (wrong
      ), or c)
      > perl unable to find path to the .exe (this seems most likely then,
      as it was
      > in the "my documents etc etc" folder). WDYT?

      I believe
      a) Dependent dll's must be seen in $ENV{'PATH'} and/or CWD
      b) See a)
      c) The .exe is in the CWD so it MUST be seen

      I have tried isolate the extracta.exe execution failure by putting it
      and it's known dependents into one directory and then setting the OS
      path to only that dir, then from the DOS command line entering:

      C:\..mylongpath>extracta.exe temp.brd status_detail.cmd

      With my normal user path this works as expected, but with my
      restricted path I get this error:

      C:\Documents and Settings\myname\My Documents\My
      Website\tests_d>extracta temp.brd status_detail.cmd
      Can't open environment file: C:\Documents and Settings\myname\My
      GLOBAL: Variable not defined Parse error in file C:\pcbenv\env,
      line 2
      Cannot open message file, env path is possibly set incorrectly.

      This seems to imply that I need other dependent files available to the
      .exe, I have tried adding ..\text\env to my CWD but this still fails.

      So I ask again: Does anyone know of a common solution to this kind of
      problem: How to run a remote executable and allow it to find it's
      dependent system files by not inhibiting the users path, all via a CGI

      I am beginning to think that I have two choices:
      1) Find all the .exe dependent files and put them into a location
      included in $ENV{'PATH'}
      2) Leave the .exe and dependents on the remote server and then
      (somehow) resolve the Network permissions problems AND include all of
      the remote server paths in $ENV{'PATH'}

      If I go for choice 1) which is definitely preferred for security
      concerns, will I need to include in my $ENV{'PATH'} all the required
      OS .dll locations or does Windows sort that out itself?

      --- In perl-beginner@yahoogroups.com, Mike Southern <gb1198@c...>
      > Below, I am not familiar with this method of calling an external

      system(@array) is a perfectly standard (and flexible) way to call the
      system command, see
      perldoc -f system

      Sorry if I am repeating myself above,

      Thanks for the comments so far.
    Your message has been successfully submitted and would be delivered to recipients shortly.