Francois Gouget : testbot/TestAgent: Automatically use the id_dsa and id_rsa keys for Net:SSH2.

Alexandre Julliard julliard at winehq.org
Tue Dec 11 13:33:32 CST 2012


Module: tools
Branch: master
Commit: ada73ac9601d41eb84849b564d61a3ab362ddb91
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=ada73ac9601d41eb84849b564d61a3ab362ddb91

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Tue Dec 11 17:55:09 2012 +0100

testbot/TestAgent: Automatically use the id_dsa and id_rsa keys for Net:SSH2.

Newer Net:SSH2 versions will automatically detect and use the id_dsa keys but older ones don't autodetect anything.

---

 testbot/lib/WineTestBot/TestAgent.pm |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/testbot/lib/WineTestBot/TestAgent.pm b/testbot/lib/WineTestBot/TestAgent.pm
index e04827a..cb63cfd 100644
--- a/testbot/lib/WineTestBot/TestAgent.pm
+++ b/testbot/lib/WineTestBot/TestAgent.pm
@@ -802,6 +802,21 @@ sub _Connect($)
     {
       $AuthOptions{$Key} = $Tunnel->{$Key} if (defined $Tunnel->{$Key});
     }
+    # Old versions of Net::SSH2 won't automatically find DSA keys, and new ones
+    # still won't automatically find RSA ones.
+    if (defined $ENV{HOME} and !exists $AuthOptions{"privatekey"} and
+        !exists $AuthOptions{"publickey"})
+    {
+      foreach my $key ("dsa", "rsa")
+      {
+        if (-f "$ENV{HOME}/.ssh/$key" and -f "$ENV{HOME}/.ssh/$key.pub")
+        {
+          $AuthOptions{"privatekey"} = "$ENV{HOME}/.ssh/$key";
+          $AuthOptions{"publickey"} = "$ENV{HOME}/.ssh/$key.pub";
+          last;
+        }
+      }
+    }
     # Interactive authentication makes no sense with automatic reconnects
     $AuthOptions{interact} = 0;
     if (!$self->{ssh}->auth(%AuthOptions))




More information about the wine-cvs mailing list