Skip to content

Commit

Permalink
fix: Ping SSH proxy use correct port (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
buhtz authored Jul 27, 2024
1 parent 79bc654 commit 9f25fb2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Back In Time
Version 1.5.1-dev (development of upcoming release)
..
* Fix: Use correct port to ping SSH Proxy (#1815)

Version 1.5.0 (2024-07-26)
* Dependency: Migration to PyQt6
Expand Down
9 changes: 7 additions & 2 deletions common/sshtools.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,12 @@ def checkPingHost(self):
if not self.config.sshCheckPingHost(self.profile_id):
return

ping_host = self.proxy_host or self.host
ping_port = self.proxy_port or self.port
if self.proxy_host:
ping_host = self.proxy_host
ping_port = self.proxy_port
else:
ping_host = self.host
ping_port = self.port

logger.debug(f'Check ping host "{ping_host}:{ping_port}"', self)
versionString = 'SSH-2.0-backintime_{}\r\n'.format(
Expand Down Expand Up @@ -754,6 +758,7 @@ def checkPingHost(self):
msg = f'Ping {self.host}{proxy_msg} failed. ' \
'Host is down or wrong address.'
logger.debug(msg, self)

raise MountException(msg)

def checkRemoteCommands(self, retry=False):
Expand Down
25 changes: 17 additions & 8 deletions qt/settingsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ def __init__(self, parent, host, port, user):
# zero margins
vlayout.setContentsMargins(0, 0, 0, 0)

checkbox = QCheckBox(_('SSH Proxy'), self)
vlayout.addWidget(checkbox)
checkbox.stateChanged.connect(self._slot_checkbox_changed)
self._checkbox = QCheckBox(_('SSH Proxy'), self)
vlayout.addWidget(self._checkbox)
self._checkbox.stateChanged.connect(self._slot_checkbox_changed)

hlayout = QHBoxLayout()
vlayout.addLayout(hlayout)
Expand Down Expand Up @@ -129,6 +129,7 @@ def _slot_checkbox_changed(self, state):
self._disable()

def _set_default(self):
"""Set GUI elements back to default."""
self.host_edit.setText('')
self.port_edit.setText('22')
self.user_edit.setText(getpass.getuser())
Expand All @@ -144,11 +145,19 @@ def _enable(self, enable=True):
lay.itemAt(idx).widget().setEnabled(enable)

def values(self):
return {
'host': self.host_edit.text(),
'port': self.port_edit.text(),
'user': self.user_edit.text(),
}
if self._checkbox.isChecked():
return {
'host': self.host_edit.text(),
'port': self.port_edit.text(),
'user': self.user_edit.text(),
}

else:
return {
'host': '',
'port': '',
'user': '',
}


class SettingsDialog(QDialog):
Expand Down

0 comments on commit 9f25fb2

Please sign in to comment.