Subject: Bug#1308: "--auth-attempts 0" doesn't deactivate interactive authentication

From: <[email-masked]>
Date: Thu, 19 Jul 2018 12:01:04 +0000

Package: pyhoca-cli
Version: 0.5.0.4

When I call "pyhoca-cli" with the following options:
	"--password" followed by a wrong password
	"--auth-attempts 0"
I get a password prompt which has actually no effect even if I enter the correct password.

Example:
pyhoca-cli --server 192.168.1.2 -u exampleUser --password 'BADPASSWORD' --auth-attempts 0 -L --libdebug

Output:
[...]
pyhoca-cli[1028] (x2goclient-pylib) NOTICE: initializing X2Go session...
pyhoca-cli[1028] (x2gocontrolsession-pylib) NOTICE: connecting to [192.168.1.2]:22
pyhoca-cli[1028] (x2gocontrolsession-pylib) DEBUG: trying SSH key discovery or agent authentication with server
pyhoca-cli[1028] (x2gocontrolsession-pylib) INFO: unlock SSH private key file with provided password
pyhoca-cli[1028] (x2gocontrolsession-pylib) DEBUG: re-trying SSH key discovery now with passphrase for unlocking the key(s)
pyhoca-cli[1028] (PyHocaCLI) NOTICE: interactive login for user ,,exampleUser''
Password:
pyhoca-cli: error: non-interactive authentication failed
pyhoca-cli[1028] (x2goguardian-pylib) DEBUG: X2Go session guardian thread waking up after 3 seconds
pyhoca-cli[1028] (x2goguardian-pylib) DEBUG: calling session cleanup on profile Pyhoca-Client_Session for terminal session:

Expected behavior:
no password prompt
just exit with returnCode: 203

Suggestion:
In "PyHocaCLI.authenticate()" let "force_password_auth" only become true if "auth_attempts" is greater than 0.

System:
"Oracle Linux Server 7.4"

thanks