fixed problem if non-default SSH port is used
This commit is contained in:
parent
fdb6967473
commit
01750dbd80
|
@ -3,7 +3,7 @@
|
||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
|
||||||
Copyright (C) 2006 - 2007 Roland Gruber
|
Copyright (C) 2006 - 2009 Roland Gruber
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -278,13 +278,7 @@ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota) {
|
||||||
echo "<tr class=\"userlist\">\n<td nowrap>" . _("SSH connection") . " </td>\n";
|
echo "<tr class=\"userlist\">\n<td nowrap>" . _("SSH connection") . " </td>\n";
|
||||||
flush();
|
flush();
|
||||||
$sshOk = false;
|
$sshOk = false;
|
||||||
$serverNameParts = explode(",", $serverName);
|
$handle = lamTestConnectSSH($serverName);
|
||||||
if (sizeof($serverNameParts) > 1) {
|
|
||||||
$handle = @ssh2_connect($serverNameParts[0], $serverNameParts[1]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$handle = @ssh2_connect($serverName);
|
|
||||||
}
|
|
||||||
if ($handle) {
|
if ($handle) {
|
||||||
if (@ssh2_auth_password($handle, $userName, $credentials[1])) {
|
if (@ssh2_auth_password($handle, $userName, $credentials[1])) {
|
||||||
$sshOk = true;
|
$sshOk = true;
|
||||||
|
@ -306,10 +300,10 @@ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota) {
|
||||||
|
|
||||||
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic\n", $stopTest, $handle, _("Execute lamdaemon"));
|
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "basic\n", $stopTest, $handle, _("Execute lamdaemon"));
|
||||||
if ($testQuota) {
|
if ($testQuota) {
|
||||||
$handle = @ssh2_connect($serverName);
|
$handle = lamTestConnectSSH($serverName);
|
||||||
@ssh2_auth_password($handle, $userName, $credentials[1]);
|
@ssh2_auth_password($handle, $userName, $credentials[1]);
|
||||||
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "quota\n", $stopTest, $handle, _("Lamdaemon: Quota module installed"));
|
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "test" . $SPLIT_DELIMITER . "quota\n", $stopTest, $handle, _("Lamdaemon: Quota module installed"));
|
||||||
$handle = @ssh2_connect($serverName);
|
$handle = lamTestConnectSSH($serverName);
|
||||||
@ssh2_auth_password($handle, $userName, $credentials[1]);
|
@ssh2_auth_password($handle, $userName, $credentials[1]);
|
||||||
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "quota" . $SPLIT_DELIMITER . "get" . $SPLIT_DELIMITER . "user\n", $stopTest, $handle, _("Lamdaemon: read quotas"));
|
$stopTest = lamTestLamdaemon("+" . $SPLIT_DELIMITER . "quota" . $SPLIT_DELIMITER . "get" . $SPLIT_DELIMITER . "user\n", $stopTest, $handle, _("Lamdaemon: read quotas"));
|
||||||
}
|
}
|
||||||
|
@ -319,4 +313,20 @@ function lamRunLamdaemonTestSuite($serverName, $serverTitle, $testQuota) {
|
||||||
echo "<h2>" . _("Lamdaemon test finished.") . "</h2>\n";
|
echo "<h2>" . _("Lamdaemon test finished.") . "</h2>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connects to the given SSH server.
|
||||||
|
*
|
||||||
|
* @param String $server server name (e.g. localhost or localhost,1234)
|
||||||
|
* @return object handle
|
||||||
|
*/
|
||||||
|
function lamTestConnectSSH($server) {
|
||||||
|
$serverNameParts = explode(",", $server);
|
||||||
|
if (sizeof($serverNameParts) > 1) {
|
||||||
|
return @ssh2_connect($serverNameParts[0], $serverNameParts[1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return @ssh2_connect($server);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue