summaryrefslogtreecommitdiff
path: root/auth
diff options
context:
space:
mode:
Diffstat (limited to 'auth')
-rw-r--r--auth/ssh.php1
-rw-r--r--auth/telnet.php6
2 files changed, 5 insertions, 2 deletions
diff --git a/auth/ssh.php b/auth/ssh.php
index bce82ab..e870861 100644
--- a/auth/ssh.php
+++ b/auth/ssh.php
@@ -48,6 +48,7 @@ final class SSH extends Authentication {
public function connect() {
$this->connection = new Net_SSH2($this->config['host'], $this->port);
+ $this->connection->setTimeout($this->config['timeout']);
$success = false;
if ($this->config['auth'] == 'ssh-password') {
diff --git a/auth/telnet.php b/auth/telnet.php
index 20b85a6..4aa7a64 100644
--- a/auth/telnet.php
+++ b/auth/telnet.php
@@ -37,9 +37,11 @@ final class Telnet extends Authentication {
}
public function connect() {
- $this->connection = fsockopen($this->config['host'], $this->port);
+ $this->connection = fsockopen($this->config['host'], $this->port, $errno,
+ $errstr, $this->config['timeout']);
if (!$this->connection) {
- throw new Exception('Cannot connect to router.');
+ throw new Exception('Cannot connect to router (code '.$errno.'['.
+ $errstr.']).');
}
fputs($this->connection, $this->config['user']."\r\n");