mirror of
https://github.com/vgough/encfs.git
synced 2025-06-20 03:37:50 +02:00
tests: explicitely verify that the reverse mount worked
This commit is contained in:
parent
68485500fd
commit
a00a3beb8e
@ -6,6 +6,8 @@ use Test::More qw( no_plan );
|
|||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Temp;
|
use File::Temp;
|
||||||
|
|
||||||
|
require("tests/common.inc");
|
||||||
|
|
||||||
my $tempDir = $ENV{'TMPDIR'} || "/tmp";
|
my $tempDir = $ENV{'TMPDIR'} || "/tmp";
|
||||||
|
|
||||||
# Helper function
|
# Helper function
|
||||||
@ -40,11 +42,24 @@ sub cleanup
|
|||||||
# Directory structure: plain -[encrypt]-> ciphertext -[decrypt]-> decrypted
|
# Directory structure: plain -[encrypt]-> ciphertext -[decrypt]-> decrypted
|
||||||
sub mount
|
sub mount
|
||||||
{
|
{
|
||||||
my $r=system("./encfs/encfs --extpass=\"echo test\" --standard $plain $ciphertext --reverse > /dev/null");
|
qx(./encfs/encfs --extpass="echo test" --standard $plain $ciphertext --reverse > /dev/null);
|
||||||
ok($r == 0, "mounted ciphertext file system");
|
ok(-f "$plain/.encfs6.xml", "plain .encfs6.xml exists") or BAIL_OUT("'$plain/.encfs6.xml'");
|
||||||
|
$e = encName(".encfs6.xml");
|
||||||
|
ok(-f "$ciphertext/$e", "encrypted .encfs6.xml exists") or BAIL_OUT("'$ciphertext/$e'");
|
||||||
|
|
||||||
$r=system("ENCFS6_CONFIG=$plain/.encfs6.xml ./encfs/encfs --extpass=\"echo test\" $ciphertext $decrypted");
|
qx(ENCFS6_CONFIG=$plain/.encfs6.xml ./encfs/encfs --extpass="echo test" $ciphertext $decrypted);
|
||||||
ok($r == 0, "mounted decrypting file system");
|
ok(-f "$decrypted/.encfs6.xml", "decrypted .encfs6.xml exists") or BAIL_OUT("'$decrypted/.encfs6.xml'");
|
||||||
|
}
|
||||||
|
|
||||||
|
# Helper function
|
||||||
|
#
|
||||||
|
# Get encrypted name for file
|
||||||
|
sub encName
|
||||||
|
{
|
||||||
|
my $name = shift;
|
||||||
|
my $enc = qx(ENCFS6_CONFIG=$plain/.encfs6.xml ./encfs/encfsctl encode --extpass="echo test" $ciphertext $name);
|
||||||
|
chomp($enc);
|
||||||
|
return $enc;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copy a directory tree and verify that the decrypted data is identical
|
# Copy a directory tree and verify that the decrypted data is identical
|
||||||
|
Loading…
x
Reference in New Issue
Block a user