Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Platform: WinNT 4.0, sp6a, IIS 4, Perl 522

Problem:

I need to read the contents of remote directories. Using readdir and looping through the array of resulting files isn't sufficient, because of the quantity of servers and files. I need to use wildcards to speed up the search (this cuts the run time from hours to minutes)and use it with either glob or a system call to dir, ex:

$filefind='ct'."$name".'*'.'.*'; $path="\\\\$server\\path"; @filea=glob (<$path\\$filefind>); @fileb=<$path\\$filefind>; @filec=`dir $path\\$filefind /b /o`;

When the code is called from the command window it runs OK. But, when called from a browser as expected dir fails, however, glob also fails, I guess it calls an exe that isn't allowed from within IIS. Looping through the files of readdir takes to long...Does anyone know how to get around the IIS command shell restriction, or another Perl way of listing remote files using wild cards that would/might work with IIS?

Thanks.
Mitch

edited: Mon Dec 16 16:57:46 2002 by jeffa - code tags, formatting

Replies are listed 'Best First'.
Re: IIS Glob-Dir Restriction
by pfaut (Priest) on Dec 16, 2002 at 15:19 UTC

    Check the event log on your remote server. You're probably getting login failures as the web server process has no rights to access the requested path.

    When run by IIS, your script runs with very limited rights using a different account than when you run it at the command line. Find out what account your web apps run under and grant it read access to the remote location. Make sure you assess the security implications of this first.

    --- print map { my ($m)=1<<hex($_)&11?' ':''; $m.=substr('AHJPacehklnorstu',hex($_),1) } split //,'2fde0abe76c36c914586c';
      Thanks for replying so fast...
      IIS has already been configured to run the code with an account that has access (Allow Anonymous Access edited to run an account with access) that's why the readdir works.
      Any other ideas?
        Just FYI: Allowing a perl script to be run remotely from IIS by anonmyous users is a bad idea as far as security goes.

        Are you taint checking?

        This has been a public service message from,
        ibanix

        $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;