mirror of
https://github.com/vgough/encfs.git
synced 2024-11-29 03:15:07 +01:00
fb9a8ff879
git-svn-id: http://encfs.googlecode.com/svn/trunk@92 db9cf616-1c43-0410-9cb8-a902689de0d6
46 lines
1.6 KiB
Perl
46 lines
1.6 KiB
Perl
#!/usr/bin/perl -w
|
|
|
|
# Sample password prompt program. Demonstration of how to interface with
|
|
# encfs's --extpass option. Note that encfs's extpass interface was chosen to
|
|
# work with existing password prompt programs, like ssh-askpass.
|
|
#
|
|
# The external password program is expected to somehow prompt for the password
|
|
# and return the password on stdout. Encfs also provides some extra
|
|
# information which is stored in environment variables.
|
|
#
|
|
# Quick Start: The only necessary part of this script for encfs operation is
|
|
# the final part which prints the password to stdout.
|
|
#
|
|
# Encfs records some environment variables with useful information:
|
|
# "encfs_root" holds a path to the raw encrypted data.
|
|
# "encfs_stdout" holds a file descriptor number which will display data to
|
|
# standard output (because standard output is used for the password).
|
|
# "encfs_stderr" holds a file descriptor number which for standard error..
|
|
|
|
use strict;
|
|
use IO::Handle;
|
|
|
|
# find out where we can send data to display to the user (assuming encfs was
|
|
# started in a terminal!)
|
|
my $realOut = $ENV{"encfs_stdout"} || fileno(STDOUT);
|
|
#my $realErr = $ENV{"encfs_stderr"} || fileno(STDERR);
|
|
#my $rootDir = $ENV{"encfs_root"} || "[unknown]";
|
|
#system("xmessage realOut=$realOut, err=$realErr");
|
|
|
|
# for grins, show all encfs related environment variables to encfs's standard
|
|
# output
|
|
my $io = new IO::Handle;
|
|
if($io->fdopen($realOut, "w"))
|
|
{
|
|
while (my ($key,$value) = each %ENV)
|
|
{
|
|
$io->print("$key=$value\n") if($key=~/encfs/);
|
|
}
|
|
}
|
|
$io->close();
|
|
|
|
## XXX XXX - This is the only part necessary for encfs to be happy.
|
|
# the functional part -- print the encfs password to stdout
|
|
print "test\n";
|
|
|