From da21c922da87caf33183cf48fe8bc9f7ec50f99a Mon Sep 17 00:00:00 2001 From: Adrian Lasota Date: Tue, 20 May 2025 12:30:48 +0200 Subject: [PATCH] Fixed empty ssh password case. fix: Changed if statements for ssh password to allow empty string --- sshtunnel.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sshtunnel.py b/sshtunnel.py index c48e330..90678dc 100644 --- a/sshtunnel.py +++ b/sshtunnel.py @@ -1165,7 +1165,7 @@ def _consolidate_auth(ssh_password=None, if isinstance(ssh_pkey, paramiko.pkey.PKey): ssh_loaded_pkeys.insert(0, ssh_pkey) - if not ssh_password and not ssh_loaded_pkeys: + if ssh_password is None and not ssh_loaded_pkeys: raise ValueError('No password or public key available!') return (ssh_password, ssh_loaded_pkeys) @@ -1410,7 +1410,7 @@ def _connect_to_gateway(self): self.logger.debug('Authentication error') self._stop_transport() - if self.ssh_password: # avoid conflict using both pass and pkey + if self.ssh_password is not None: # avoid conflict using both pass and pkey self.logger.debug('Trying to log in with password: {0}' .format('*' * len(self.ssh_password))) try: