robin said:
is there any way to use perl to check if the directory the script you
are running is in the cgi-bin proper. I don't mean just reading the
name of the current directory because what if someone just named the
directory "cgi-bin"- if there's no way to do it in perl, what's the
*nix command?
thanks,
-Robin
In addition to what Matt has said:
there is no unix command as such: as a gross simplification you could
grep the webserver configuration file(s) for whichever directive
configures cgi-bin directories. eg in Apache you would look for
ScriptAlias, but then following that you would have to look at the
configuration of the directory at which ScriptAlias points. If you are
running under mod_perl you could possibly access this via the API.
As far as figuring out execute permissions on the file itself and search
permissions on the directory, you need to look at the filetest operators in
man perlop
Webserver configuration and unix file permissions work in tandem in a
webserver environment (the latter, obviously, take priority).
To repeat what Matt said, what *is* it you are trying to do? It wouldn't
be the first time that you have tried to fit a round peg to a square
hole. Are you trying to work out some half-baked "security" system to
control execution on the server?
Mark