diff options
author | Guillaume Mazoyer <respawneral@gmail.com> | 2014-08-03 23:55:08 +0200 |
---|---|---|
committer | Guillaume Mazoyer <respawneral@gmail.com> | 2014-08-03 23:55:08 +0200 |
commit | 5b6dbececd1c158e8fdb1c2458a2be5528ad38b8 (patch) | |
tree | 93518bce2a6ef1d5d6ce04f44315e0e74755bbf1 /auth/ssh.php | |
parent | b26e4808e59cd499ead2c42f74bf94ca8f434718 (diff) |
Be sure to login and disconnect after each command.
Diffstat (limited to 'auth/ssh.php')
-rw-r--r-- | auth/ssh.php | 8 |
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; } |