check for directory being cgi-bin

Discussion in 'Perl Misc' started by robin, Sep 4, 2005.

  1. robin

    robin Guest

    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
     
    robin, Sep 4, 2005
    #1
    1. Advertising

  2. robin

    Matt Garrish Guest

    "robin" <> wrote in message
    news:...
    > 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
     
    Matt Garrish, Sep 4, 2005
    #2
    1. Advertising

  3. robin

    robin Guest

    you're right about what it is I want to know. any suggestions? and
    sorry that I was unclear.
    -robin
     
    robin, Sep 4, 2005
    #3
  4. "robin" <> wrote in news:1125802817.922467.112140
    @g44g2000cwa.googlegroups.com:

    > 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
    --
    A. Sinan Unur <>
    (reverse each component and remove .invalid for email address)

    comp.lang.perl.misc guidelines on the WWW:
    http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
     
    A. Sinan Unur, Sep 4, 2005
    #4
  5. robin wrote:
    > 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
     
    Mark Clements, Sep 4, 2005
    #5
  6. robin

    Matt Garrish Guest

    "robin" <> wrote in message
    news:...
    > 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
     
    Matt Garrish, Sep 4, 2005
    #6
  7. robin

    Joe Smith Guest

    robin wrote:
    > 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
     
    Joe Smith, Sep 6, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Mitchell

    Can "bin" be changed to "cgi-bin" for asp.net

    Kevin Mitchell, Oct 19, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    834
    Wim Hollebrandse
    Oct 19, 2003
  2. Jon Ballinger
    Replies:
    2
    Views:
    331
    Jon Ballinger
    Oct 30, 2003
  3. anne001
    Replies:
    1
    Views:
    461
  4. zippy

    cgi and cgi-bin

    zippy, Feb 1, 2005, in forum: Perl Misc
    Replies:
    5
    Views:
    340
    Sam Holden
    Feb 2, 2005
  5. BestFriend
    Replies:
    2
    Views:
    781
Loading...

Share This Page