Perl

Moderators: Jonathan
Number of threads: 1259
Number of posts: 3644

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
problem in opening a network directory in CGI Posted by snitch on 24 Feb 2004 at 4:20 AM
Hi there,
I have the following sinppet of code

#!C:\Perl\bin\perl.exe

print "Content-type: text/html\r\n\r\n";

print "<Head>";
print "<Title>";
print "Contents of directory";
print "</Title>";
print "<body bgcolor='#CCFFFF'>";

$dir='\\\\<ip addr>\\abc\\def\\';

if(!opendir(DIR, $dir);){
print "Can't Open Directory $dir";
closedir DIR;
die;
}
@dots = readdir(DIR);
foreach (@dots){
print "$_\n";
print "<br>";
}

closedir DIR;

This fails and it flags an error sayin it cannot open the directory.
The same thing works fine wen executed on command prompt .
but we try in HTML it is not working ..
also tried mapping the n/w to a drive and opening it again it fails ...

n e clues ???


curcio
snitch
Report
Re: problem in opening a network directory in CGI Posted by Jonathan on 24 Feb 2004 at 7:13 AM
: Hi there,
: I have the following sinppet of code
:
: #!C:\Perl\bin\perl.exe
:
: print "Content-type: text/html\r\n\r\n";
:
: print "<Head>";
: print "<Title>";
: print "Contents of directory";
: print "</Title>";
: print "<body bgcolor='#CCFFFF'>";
:
: $dir='\\\\<ip addr>\\abc\\def\\';
:
: if(!opendir(DIR, $dir);){
: print "Can't Open Directory $dir";
: closedir DIR;
: die;
: }
: @dots = readdir(DIR);
: foreach (@dots){
: print "$_\n";
: print "";
: }
:
: closedir DIR;
:
: This fails and it flags an error sayin it cannot open the directory.
: The same thing works fine wen executed on command prompt .
: but we try in HTML it is not working ..
: also tried mapping the n/w to a drive and opening it again it fails ...
:
: n e clues ???
:
If it works at the command line but not as a CGI script I'd reckon it's a permissions issue. Figure out what user the script runs as when running as a CGI, and grant that user the required permissions to access the network and other network drives as needed.

Jonathan


###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Report
Re: problem in opening a network directory in CGI Posted by snitch on 25 Feb 2004 at 12:54 AM
Well even i thought so ...
but I am working in windows 2000 environment with IIS 4.0 installed.
don't hav a clue abt the problem.

curcio,
snitch

: : Hi there,
: : I have the following sinppet of code
: :
: : #!C:\Perl\bin\perl.exe
: :
: : print "Content-type: text/html\r\n\r\n";
: :
: : print "<Head>";
: : print "<Title>";
: : print "Contents of directory";
: : print "</Title>";
: : print "<body bgcolor='#CCFFFF'>";
: :
: : $dir='\\\\<ip addr>\\abc\\def\\';
: :
: : if(!opendir(DIR, $dir);){
: : print "Can't Open Directory $dir";
: : closedir DIR;
: : die;
: : }
: : @dots = readdir(DIR);
: : foreach (@dots){
: : print "$_\n";
: : print "";
: : }
: :
: : closedir DIR;
: :
: : This fails and it flags an error sayin it cannot open the directory.
: : The same thing works fine wen executed on command prompt .
: : but we try in HTML it is not working ..
: : also tried mapping the n/w to a drive and opening it again it fails ...
: :
: : n e clues ???
: :
: If it works at the command line but not as a CGI script I'd reckon it's a permissions issue. Figure out what user the script runs as when running as a CGI, and grant that user the required permissions to access the network and other network drives as needed.
:
: Jonathan
:
:
: ###
: for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
: /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
:
:
Report
Re: problem in opening a network directory in CGI Posted by Jonathan on 25 Feb 2004 at 5:14 AM
: Well even i thought so ...
: but I am working in windows 2000 environment with IIS 4.0 installed.
: don't hav a clue abt the problem.
:
I guessed. I've previously worked in that environment too, and I remember having to spend time on a number of occasions with the NT sysadmin getting file privs set up so my script could access files in places we wanted it to. The default is that it can't. You need to explicitly set this up.

Jonathan

###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

Report
Re: problem in opening a network directory in CGI Posted by snitch on 25 Feb 2004 at 5:31 AM
I tried ... but can't figure it out where i have to set it ...
and am the sys admin here ...
so can ya pls guide where i can set it ???

curcio
snitch
: : Well even i thought so ...
: : but I am working in windows 2000 environment with IIS 4.0 installed.
: : don't hav a clue abt the problem.
: :
: I guessed. I've previously worked in that environment too, and I remember having to spend time on a number of occasions with the NT sysadmin getting file privs set up so my script could access files in places we wanted it to. The default is that it can't. You need to explicitly set this up.
:
: Jonathan
:
: ###
: for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
: /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
:
:
Report
Re: problem in opening a network directory in CGI Posted by Jonathan on 25 Feb 2004 at 7:06 AM
: I tried ... but can't figure it out where i have to set it ...
: and am the sys admin here ...
: so can ya pls guide where i can set it ???
It's just set up as file access permissions normally are. You just need to find what user the script runs as - I can't remember the user name you are looking for but it may be something like wwwuser. Once you find that you need to give that user permissions to read (and/or write, etc) the share you want them to have access to. Just like you grant any normal user permissions.

I ain't an NT sys admin, I just watched.

Jonathan


###
for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
(tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
/(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.