summaryrefslogtreecommitdiff
path: root/auth/ssh.php
diff options
context:
space:
mode:
Diffstat (limited to 'auth/ssh.php')
-rw-r--r--auth/ssh.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/auth/ssh.php b/auth/ssh.php
index a8a74b9..5fdd489 100644
--- a/auth/ssh.php
+++ b/auth/ssh.php
@@ -71,17 +71,17 @@ final class SSH extends Authentication {
}
public function send_command($command) {
- if (($this->connection == null) || !$this->connection->isConnected()) {
- $this->connect();
- }
+ $this->connect();
$data = $this->connection->exec($command);
+ $this->disconnect();
+
return $data;
}
public function disconnect() {
- if ($this->connection != null) {
+ if (($this->connection != null) && $this->connection->isConnected()) {
$this->connection->disconnect();
$this->connection = null;
}