NAME
Filesys::Virtual::Chroot - Virtual File system Tool
DESCRIPTION
Provide a virtual chroot environment. This module only simulates a chroot environment and only provides a advisory functions for your application. This module is NOT intended to provide application security!!!
SYNOPSIS
#!/usr/bin/perl
use strict;
use Filesys::Virtual::Chroot;
my $cr = Filesys::Virtual::Chroot->new(
c => '/tmp',
i => 0
) || die $Filesys::Virtual::Chroot::errstr;
print " Root: " . $cr->rroot . "\n";
print " Fake: " . $cr->vpwd . "\n";
if($cr->vchdir($ARGV[0])){
print " Change directory success\r\n";
print " Root: " . $cr->rroot . "\n";
print " Real: " . $cr->rcwd . "\n";
print " Fake: " . $cr->vcwd . "\n";
} else {
print $cr->errstr . "\n";
}
exit;
METHODS
new( %Options )
Create a new Filesys::Virtual::Chroot object.
Options
chroot - The full path of the directory which will be virtual chroot'd
c - Same as chroot
no_force_case - Don't force case matching, Turn this on, on windows machines.
i - Same as no_force_case
Error handling
If something happens which results in an error, nothing will be returned and the Filesys::Virtual::Chroot::errstr will be set with the error message.
errstr()
Return the last error message captured.
rroot()
Return the real full root path of the virtual chroot'd environment.
lchdir()
Return the last real directory that was changed to with $cr->vchdir()
vchdir(path)
Change the virtual directory and return the virtual directory that was changed to.
rpath(file)
Return the real full path of <file> if <file> is within the virtual chroot environment
vcwd()
Return the virtual current working directory
vpwd(path)
aliase for the vcwd() command.
rcwd()
Return the real current working directory
rpwd()
aliase for the rcwd() command.