fixes for new ssh2 extension

This commit is contained in:
Roland Gruber 2008-12-18 14:44:42 +00:00
parent 49a0222918
commit 11fd63d6a8
1 changed files with 14 additions and 1 deletions

View File

@ -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 "<td>" . $failImage . "&nbsp;&nbsp;</td>\n";
echo "<td>\n";
StatusMessage("ERROR", _("Unable to connect to remote server!"));
echo "</td>\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"));
}