From f4f072501cf43f73d84081cf3035a0d45c88c367 Mon Sep 17 00:00:00 2001 From: Guillaume Mazoyer Date: Sun, 3 Aug 2014 16:08:59 +0200 Subject: Fix send command if reconnection is needed when using SSH. --- auth/ssh.php | 4 ++-- utils.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/auth/ssh.php b/auth/ssh.php index 68fd927..b2f96de 100644 --- a/auth/ssh.php +++ b/auth/ssh.php @@ -71,7 +71,7 @@ final class SSH extends Authentication { } public function send_command($command) { - if ($this->connection == null) { + if (($this->connection == null) || !$this->connection->isConnected()) { $this->connect(); } @@ -81,7 +81,7 @@ final class SSH extends Authentication { } public function disconnect() { - $this->send_command('exit'); + $this->connection->disconnect(); $this->connection = null; } } diff --git a/utils.php b/utils.php index fb1c1a8..99a6a06 100644 --- a/utils.php +++ b/utils.php @@ -96,5 +96,4 @@ function log_to_file($log) { file_put_contents($config['misc']['logs'], $log, FILE_APPEND | LOCK_EX); } - // End of utils.php -- cgit v1.2.3