[Bps-public-commit] r16889 - in Pushmi/trunk: lib/Pushmi

alexmv at bestpractical.com alexmv at bestpractical.com
Tue Nov 18 14:34:16 EST 2008


Author: alexmv
Date: Tue Nov 18 14:34:14 2008
New Revision: 16889

Modified:
   Pushmi/trunk/   (props changed)
   Pushmi/trunk/lib/Pushmi/Command.pm

Log:
 r39259 at kohr-ah:  chmrr | 2008-11-18 14:34:03 -0500
  * Support saving SSL fingerprint in config file


Modified: Pushmi/trunk/lib/Pushmi/Command.pm
==============================================================================
--- Pushmi/trunk/lib/Pushmi/Command.pm	(original)
+++ Pushmi/trunk/lib/Pushmi/Command.pm	Tue Nov 18 14:34:14 2008
@@ -24,9 +24,7 @@
         [ $config->{use_cached_auth} ? SVN::Client::get_simple_provider() : (),
           SVN::Client::get_username_provider(),
           SVN::Client::get_ssl_server_trust_file_provider(),
-          SVN::Client::get_ssl_server_trust_prompt_provider(
-                \&SVK::Config::_ssl_server_trust_prompt
-          ),
+          SVN::Client::get_ssl_server_trust_prompt_provider( \&pushmi_ssl_server ),
           SVN::Client::get_simple_prompt_provider( $auth, 0 ) ]
     });
 }
@@ -122,6 +120,21 @@
     return $SVN::_Core::SVN_NO_ERROR;
 }
 
+sub pushmi_ssl_server {
+    my ($cred, $realm, $failures, $cert_info, $may_save, $pool) = @_;
+    my $config = Pushmi::Config->config;
+    unless (defined $config->{ssl_fingerprint}) {
+        Pushmi::Command->logger->warn("unable to get trusted SSL fingerprint from config file.");
+        return SVK::Config::_ssl_server_trust_prompt(@_);
+    }
+
+    Pushmi::Command->logger->logdie("SSL fingerprint does not match.")
+        unless $config->{ssl_fingerprint} eq $cert_info->fingerprint;
+    $cred->may_save(0);
+    $cred->accepted_failures($failures);
+    return $SVN::_Core::SVN_NO_ERROR;
+}
+
 sub requires_svn_version {
     my ($self, $version, $message) = @_;
     die $message."\n" if $SVN::Core::VERSION lt $version;



More information about the Bps-public-commit mailing list