r419@erker: lars | 2008-09-28 11:39:00 +0200

encryption modules:
 * module loading should fail, if gnupg resp. gpg-ezmlm is not installed
 * fixed minor code style issue
This commit is contained in:
lars 2008-09-29 20:44:38 +00:00
parent 18541ef2be
commit 84bb54f428
2 changed files with 13 additions and 1 deletions

View file

@ -73,6 +73,11 @@ $ENV{SHELL} = '/bin/sh' if exists $ENV{SHELL};
delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
# check, if gpg-ezmlm is installed
unless (-x "$GPG_EZMLM_BASE/gpg-ezmlm-manage.pl") {
die("Warning: gpg-ezmlm does not seem to be installed - "
. "executable '$GPG_EZMLM_BASE/gpg-ezmlm-manage.pl' not found!");
}
# == Initialiser - Returns a reference to the object == # == Initialiser - Returns a reference to the object ==

View file

@ -77,6 +77,13 @@ $GPG_BIN = '/bin/gpg'
# == clean up the path == # == clean up the path ==
local $ENV{'PATH'} = "/bin"; local $ENV{'PATH'} = "/bin";
# check, if gpg is installed
unless (-x "$GPG_BIN") {
die("Warning: gnupg does not seem to be installed - none of the "
. "executables 'gpg' or 'gpg2' were found at the usual locations!");
}
# == Initialiser - Returns a reference to the object == # == Initialiser - Returns a reference to the object ==
=head2 Setting up a new Mail::Ezmlm::GpgKeyRing object: =head2 Setting up a new Mail::Ezmlm::GpgKeyRing object:
@ -306,7 +313,7 @@ sub _get_gpg_object() {
my $gpg = new Crypt::GPG(); my $gpg = new Crypt::GPG();
my $dirname = $self->get_location(); my $dirname = $self->get_location();
# replace whitespace characters in the keyring directory name # replace whitespace characters in the keyring directory name
$dirname =~ s/(\s)/\\\1/g; $dirname =~ s/(\s)/\\$1/g;
$gpg->gpgbin($GPG_BIN); $gpg->gpgbin($GPG_BIN);
$gpg->gpgopts("--lock-multiple --no-tty --no-secmem-warning --batch --quiet --homedir $dirname"); $gpg->gpgopts("--lock-multiple --no-tty --no-secmem-warning --batch --quiet --homedir $dirname");
return $gpg; return $gpg;