Subject: do not look for keys when one is supplied already

From: [email-masked]
Date: Thu, 10 May 2018 20:28:07 +0200

Package: python-x2go
Version: 0.5.99.0
Tag: patch

When a server and no profile is selected and a ssh-key is provided 
python-x2go will ignore the provided ssh key and ask for a password 
instead.

$ mkdir ~/.x2go
$ docker run -it -d -p 2222:22 --name=x2go 
quay.io/tatsuya6502/x2go:latest
$ docker logs x2go | tail -n +2 > ~/.x2go/x2go-key
$ pyhoca-cli --server localhost --ssh-key ~/.x2go/x2go-key -p 2222 -N -c 
xclock --user docker

From 97846b961a61d66fbf295f74296330e446aa372e Mon Sep 17 00:00:00 2001
From: nounce <[email-masked]>
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