From 11fd63d6a845fd1cbacf17fdeacaf471bc373137 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 18 Dec 2008 14:44:42 +0000 Subject: [PATCH] fixes for new ssh2 extension --- lam/templates/tests/lamdaemonTest.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lam/templates/tests/lamdaemonTest.php b/lam/templates/tests/lamdaemonTest.php index f1ebe752..dfcd4d88 100644 --- a/lam/templates/tests/lamdaemonTest.php +++ b/lam/templates/tests/lamdaemonTest.php @@ -137,6 +137,13 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) { flush(); $lamdaemonOk = false; $shell = ssh2_exec($handle, "sudo " . $_SESSION['config']->get_scriptPath()); + if (!$shell) { + echo "" . $failImage . "  \n"; + echo "\n"; + StatusMessage("ERROR", _("Unable to connect to remote server!")); + echo "\n"; + return true; + } $stderr = ssh2_fetch_stream($shell, SSH2_STREAM_STDERR); fwrite($shell, $command); $return = array(); @@ -161,6 +168,8 @@ function lamTestLamdaemon($command, $stopTest, $handle, $testText) { elseif (strlen($errOut) > 0) { $return[] = "ERROR," . _("Unknown error") . "," . htmlspecialchars(str_replace(",", " ", $errOut)); } + @fclose($shell); + @fclose($stderr); if ((sizeof($return) == 1) && (strpos(strtolower($return[0]), "error") === false)) { $lamdaemonOk = true; } @@ -294,10 +303,14 @@ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota) { } flush(); - + $stopTest = lamTestLamdaemon("+ test basic\n", $stopTest, $handle, _("Execute lamdaemon")); if ($testQuota) { + $handle = @ssh2_connect($serverName); + @ssh2_auth_password($handle, $userName, $credentials[1]); $stopTest = lamTestLamdaemon("+ test quota\n", $stopTest, $handle, _("Lamdaemon: Quota module installed")); + $handle = @ssh2_connect($serverName); + @ssh2_auth_password($handle, $userName, $credentials[1]); $stopTest = lamTestLamdaemon("+ quota get user\n", $stopTest, $handle, _("Lamdaemon: read quotas")); }