diff options
author | Dylan William Hardison <dylan@hardison.net> | 2016-09-23 23:35:53 +0200 |
---|---|---|
committer | Dylan William Hardison <dylan@hardison.net> | 2016-09-23 23:36:08 +0200 |
commit | 38e3b75a40ceda26e470198b3dfd44b3dbc03509 (patch) | |
tree | 8ed8d19d0e7c1a933df03d0a8d2c3a696a1d79bd | |
parent | 6fed7d428af3bacf2220e16cd4f3dd21c3e9bfb6 (diff) | |
download | bugzilla-38e3b75a40ceda26e470198b3dfd44b3dbc03509.tar.gz bugzilla-38e3b75a40ceda26e470198b3dfd44b3dbc03509.tar.xz |
Bug 1304248 - Add sanity test to check for the Crypt::OpenPGP issue #30
-rw-r--r-- | t/901-secure-mail-loop.t | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/t/901-secure-mail-loop.t b/t/901-secure-mail-loop.t new file mode 100644 index 000000000..bfecb82c7 --- /dev/null +++ b/t/901-secure-mail-loop.t @@ -0,0 +1,74 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. +use strict; +use warnings; +use 5.10.1; +use Test::More tests => 1; + +use Crypt::OpenPGP; + +my $pubring = new Crypt::OpenPGP::KeyRing(Data => PUBLIC_KEY()); +my $pgp = new Crypt::OpenPGP(PubRing => $pubring); +{ + local $SIG{ALRM} = sub { fail("stuck in a loop"); exit; }; + alarm(5); + my $encrypted = $pgp->encrypt( + Data => "hello, world", + Recipients => "@", + Cipher => 'CAST5', + Armour => 0 + ); + alarm(0); +} +pass("didn't get stuck in a loop"); + +sub PUBLIC_KEY { + return <<'KEY'; +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQGiBEkjw1kRBADkcYTvXYkfcDwkYquDUU7OPsGSlF2MOQssJ+lF5MT8XdyzoVU1 +eEYV/1U4IrzC6k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