check for directory being cgi-bin

R

robin

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
 
M

Matt Garrish

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?

What is a cgi-bin proper?

Any number of directories can run cgi programs and all would be legitimate
"cgi-bins". I suspect you want to know if the directory has execute
permissions coupled with whether it is accessible from your web server, but
until you give a clear explanation of what it is you are doing and what
you're hoping to accomplish (and what you've tried) I leave you to figure
out the details on your own.

Matt
 
R

robin

you're right about what it is I want to know. any suggestions? and
sorry that I was unclear.
-robin
 
A

A. Sinan Unur

you're right about what it is I want to know. any suggestions? and
sorry that I was unclear.

And now you are very clear ... as mud.

*Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh*
*Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh*
*Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh* *Sigh*

Sinan
 
M

Mark Clements

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
 
M

Matt Garrish

robin said:
you're right about what it is I want to know. any suggestions? and
sorry that I was unclear.

How long have you been posting here now? I've been gone for the better part
of a year and I still had the feeling that responding to you would just be a
waste of time. Remember how you've been asked to provide context when you
reply? Remember how you've been pointed numerous times to the posting
guidelines. Remember... (ah, what's the use?)

If you aren't going to explain your problem so that people can assess what
it is you're doing, you're not going to get any help (e.g., what server are
you using? what system does it run on? why is this important? what is your
end goal?) .

My advice then would be to seek out a group that deals with whatever web
server you're using and ask there how to do what it is you want in more
detail, since there is nothing about your problem as stated that is
particular to using perl.

Matt
 
J

Joe Smith

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.

Why would you want to know?

This sounds like an XY problem. You're asking about X but you're really
trying to accomplish Y. What, exactly, is the Y you're trying to do?
-Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top