From 97846b961a61d66fbf295f74296330e446aa372e Mon Sep 17 00:00:00 2001
From: nounce <nounce@posteo.net>
Date: Thu, 10 May 2018 20:00:09 +0200
Subject: [PATCH 1/1] Do not look for keys if there is one supplied already

---
 x2go/backends/control/plain.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/x2go/backends/control/plain.py b/x2go/backends/control/plain.py
index de56286..2d0ccf5 100644
--- a/x2go/backends/control/plain.py
+++ b/x2go/backends/control/plain.py
@@ -926,9 +926,9 @@ class X2GoControlSession(paramiko.SSHClient):
         if forward_sshagent is None:
             forward_sshagent = self.forward_sshagent
 
-        if look_for_keys:
-            key_filename = None
-            pkey = None
+        # Do not look for keys if there is one supplied already
+        if key_filename or pkey:
+            look_for_keys = False
 
         _twofactorauth = False
         if password and (passphrase is None) and not force_password_auth: passphrase = password
-- 
2.17.0

