[Rt-commit] rt branch, 4.0/mailgate-ssl-deps, updated. rt-4.0.4-117-g0b7e1df

Alex Vandiver alexmv at bestpractical.com
Thu Dec 29 19:02:15 EST 2011


The branch, 4.0/mailgate-ssl-deps has been updated
       via  0b7e1df5940526422603a1acb31d7ac053beba66 (commit)
       via  a04886131b78f7cf4f086adf68e1eed8732e48fc (commit)
      from  b43bb9ff0031ccbefbeba344f020d86cbf52c1f4 (commit)

Summary of changes:
 bin/rt-mailgate.in           |   13 +++++++++++--
 sbin/rt-test-dependencies.in |    1 +
 2 files changed, 12 insertions(+), 2 deletions(-)

- Log -----------------------------------------------------------------
commit a04886131b78f7cf4f086adf68e1eed8732e48fc
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Dec 29 18:53:13 2011 -0500

    Restore back-compat for pre-6.0 versions of LWP::UserAgent
    
    The ssl_opts method, which is used to handle verification of SSL
    certificates, was added in version 6.0 of LWP.  Rather than bump the LWP
    dependency during a stable series, fall back to not attempting to check
    certificates if we are running on a pre-6.0 LWP.  In this case, an
    explicit --verify-ssl argument produces an error.

diff --git a/bin/rt-mailgate.in b/bin/rt-mailgate.in
index b679298..7badfe7 100755
--- a/bin/rt-mailgate.in
+++ b/bin/rt-mailgate.in
@@ -57,12 +57,17 @@ use warnings;
 
 use Getopt::Long;
 
-my $opts = { 'verify-ssl' => 1 };
+my $opts = { };
 GetOptions( $opts,   "queue=s", "action=s", "url=s",
             "jar=s", "help",    "debug",    "extension=s",
             "timeout=i", "verify-ssl!",
           );
 
+die "Verifying SSL certificates requires LWP::UserAgent 6.0 or higher.\n"
+    if $opts->{"verify-ssl"} and not LWP::UserAgent->can("ssl_opts");
+
+$opts->{"verify-ssl"} = 1 unless defined $opts->{"verify-ssl"};
+
 my $gateway = RT::Client::MailGateway->new();
 
 $gateway->run($opts);
@@ -150,7 +155,8 @@ sub get_useragent {
     my $opts = shift;
     my $ua   = LWP::UserAgent->new();
     $ua->cookie_jar( { file => $opts->{'jar'} } ) if $opts->{'jar'};
-    $ua->ssl_opts( verify_hostname => $opts->{'verify-ssl'} );
+    $ua->ssl_opts( verify_hostname => $opts->{'verify-ssl'} )
+        if $ua->can("ssl_opts");
     return $ua;
 }
 
@@ -367,6 +373,9 @@ of CA.  This is required if you have a self-signed certificate, or some
 other certificate which is not traceable back to an certificate your
 system ultimitely trusts.
 
+Verifying SSL certificates requires L<LWP::UserAgent> version 6.0 or
+higher; explicitly passing C<--verify-ssl> on prior versions will error.
+
 =item C<--extension> OPTIONAL
 
 Some MTAs will route mail sent to user-foo at host or user+foo at host to user at host

commit 0b7e1df5940526422603a1acb31d7ac053beba66
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Dec 29 18:59:55 2011 -0500

    SSL verification was only added to LWP::UserAgent in version 6.0 and higher

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 97859a6..bdca242 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -255,6 +255,7 @@ Pod::Usage
 $deps{'SSL-MAILGATE'} = [ text_to_hash( << '.') ];
 Crypt::SSLeay
 Net::SSL
+LWP::UserAgent 6.0
 LWP::Protocol::https
 Mozilla::CA
 .

-----------------------------------------------------------------------


More information about the Rt-commit mailing list