version check for gpg-ezmlm added

README updated
using "strict" for test.pl
This commit is contained in:
lars 2006-04-19 00:45:18 +00:00
parent 52c1dfca0f
commit 88057a6f65
3 changed files with 29 additions and 14 deletions

View file

@ -633,7 +633,7 @@ sub get_public_keys {
# == get_private_keys == # == get_private_keys ==
# for POD see above (get_public_keys) # see above for POD (get_public_keys)
sub get_secret_keys { sub get_secret_keys {
my ($self) = @_; my ($self) = @_;
my @keys = $self->_get_keys("sec"); my @keys = $self->_get_keys("sec");
@ -641,6 +641,17 @@ sub get_secret_keys {
} }
# == check version of gpg-ezmlm ==
sub check_gpg_ezmlm_version {
my $ret_value = system("'$GPG_EZMLM_BASE/gpg-ezmlm-convert.pl' --version &>/dev/null");
# for now we do not need a specific version of gpg-ezmlm - it just has to
# know the "--version" argument (available since gpg-ezmlm 0.3.4)
return ($ret_value == 0);
}
############ some internal functions ##############
# == internal function for creating a gpg object == # == internal function for creating a gpg object ==
sub _get_gpg_object() { sub _get_gpg_object() {
my ($self) = @_; my ($self) = @_;

View file

@ -1,4 +1,4 @@
Ezmlm.pm Mail::Ezmlm:Gpg
Object methods for gpg-ezmlm mailing lists Object methods for gpg-ezmlm mailing lists
(see http://www.synacklabs.net/projects/crypt-ml) (see http://www.synacklabs.net/projects/crypt-ml)
@ -9,9 +9,8 @@ Install by doing the following ...
# make install # make install
One thing. For some reason MakeMaker doesn't like symlinks. Please make sure One thing. For some reason MakeMaker doesn't like symlinks. Please make sure
you use the full cantonical path for the qmail and ezmlm binaries. you use the full cantonical path for the gnupg and gpg-ezmlm binaries.
Documentation is in pod format. Please run perldoc Mail::Ezmlm::Gpg after you have Read the documentation by running "man Mail::Ezmlm::Gpg".
installed it.
- Lars Kruse <devel@sumpfralle.de> - Lars Kruse <devel@sumpfralle.de>

View file

@ -15,7 +15,9 @@
use Test; use Test;
BEGIN { plan tests => 5 } use strict;
BEGIN { plan tests => 13 }
print "Trying to load the Mail::Ezmlm module: "; print "Trying to load the Mail::Ezmlm module: ";
eval { require Mail::Ezmlm; return 1;}; eval { require Mail::Ezmlm; return 1;};
@ -23,22 +25,25 @@ ok($@,'');
croak() if $@; # If Mail::Ezmlm didn't load... bail hard now croak() if $@; # If Mail::Ezmlm didn't load... bail hard now
print "Trying to load the Mail::Ezmlm::Gpg module: "; print "Trying to load the Mail::Ezmlm::Gpg module: ";
eval { require Mail::Ezmlm::Gpg; return 1;}; eval { require "Gpg.pm"; return 1;};
ok($@,''); ok($@,'');
croak() if $@; # Mail::Ezmlm::Gpg is essential ... croak() if $@; # Mail::Ezmlm::Gpg is essential ...
######################### End of black magic. print "Checking version of gpg-ezmlm: ";
my $version_check = Mail::Ezmlm::Gpg->check_gpg_ezmlm_version();
ok($version_check);
croak() unless ($version_check); # the version of gpg-ezmlm is important
use Cwd; use Cwd;
$list = new Mail::Ezmlm; my $list = new Mail::Ezmlm;
# create a temp directory if necessary # create a temp directory if necessary
$TMP = cwd() . '/gpg-ezmlmtmp'; my $TMP = cwd() . '/gpg-ezmlmtmp';
mkdir $TMP, 0755 unless (-d $TMP); mkdir $TMP, 0755 unless (-d $TMP);
print 'Checking list creation with Mail::Ezmlm: '; print 'Checking list creation with Mail::Ezmlm: ';
$test1 = $list->make(-name=>"ezmlm-test1-$$", my $test1 = $list->make(-name=>"ezmlm-test1-$$",
-qmail=>"$TMP/.qmail-ezmlm-test1-$$", -qmail=>"$TMP/.qmail-ezmlm-test1-$$",
-dir=>"$TMP/ezmlm-test1-$$"); -dir=>"$TMP/ezmlm-test1-$$");
@ -49,7 +54,7 @@ system("cp", "-a", $list->{'LIST_NAME'}, $list->{'LIST_NAME'} . ".backup");
print 'Testing list conversion from plaintext to encryption: '; print 'Testing list conversion from plaintext to encryption: ';
$gpg_list = new Mail::Ezmlm::Gpg($list->{'LIST_NAME'}); my $gpg_list = new Mail::Ezmlm::Gpg($list->{'LIST_NAME'});
ok($gpg_list->convert_to_encrypted() && $gpg_list->is_gpg()); ok($gpg_list->convert_to_encrypted() && $gpg_list->is_gpg());
@ -80,7 +85,7 @@ ok(!$update_failed);
print 'Testing key generation: '; print 'Testing key generation: ';
ok($gpg_list->generate_private_key("Name", "Comment", "mail@addr.ess", 1024, 0)); ok($gpg_list->generate_private_key('Name', 'Comment', 'mail@addr.ess', 1024, 0));
print 'Testing key retrieval: '; print 'Testing key retrieval: ';
@ -91,7 +96,7 @@ ok((@pub_keys == 1) && (@sec_keys == 1));
print 'Testing key export: '; print 'Testing key export: ';
my $keyid = $pub_keys[0]{id}; my $keyid = $pub_keys[0]{id};
ok($gpg_list->export_key($keyid)); ok($keyid && $gpg_list->export_key($keyid));
print 'Testing key deletion: '; print 'Testing key deletion: ';