On Mon, Mar 25, 2002 at 11:51:32PM +0000, Earwig wrote:
> On Tue, 26 Mar 2002, Andrew O'Brien wrote:
[snip]
> I'm not mounting. Filesys::SmbClient appears to make a fresh SMB
> connection each time one of its methods (open, opendir, unlink, mkdir,
> etc) is called. Running outside of Apache/Embperl, I have no problem with
> it. But inside, it is somehow recalling the file descriptor and the fact
> that it connected successfully before.
>
> Here's a condensed version of my code... the form page sends
> user_id, passwd and server_name, then this tries to simply open a share to
> authenticate the user.
>
>
> [$var $smb $fd $server_name $user_id $passwd $]
>
> [-
> use Filesys::SmbClient;
> $smb = new Filesys::SmbClient(username => "$user_id}", password =>
> "$passwd", workgroup => "WORKGROUP", debug => 10);
>
> $fd = $smb->opendir('smb://'.$server_name.'/'.$user_id.'$');
> -]
>
> [$if ($fd=0) $]
>
> Success!
>
> [$else$]
>
> Failure!
>
> [$endif$]
$fd is a file descriptor, or 0 on failure. The code above *sets* $fd to
0, thereby "losing" a file descriptor. The call to closedir() is with a
value that doesn't correspond to the original return from
opendir(). That may be your problem?
This should be:
[$ if ($fd == 0) $]
Failure: [+ $! +]
[$ else $]
Success!
[$ endif $]
> [-
> $smb->closedir($fd);
> undef $smb;
> -]
--
Andrew O'Brien
Senior Engineer email: [EMAIL PROTECTED]
Switch Online Group Pty Limited phone: +61 2 9299 1133
ABN 89 092 286 327 fax: +61 2 9299 1134
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]