1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-11-27 12:55:58 +01:00

Merge branch 'master' into php5

* master:
  SSH2: rm redundant part of SSH2 unit test
  SSH2: add unit test for getServerPublicHostKey
  SSH2: make it so you can verify server public host key without logging on
This commit is contained in:
Andreas Fischer 2014-06-17 11:37:37 +02:00
commit 563b8af6ce
2 changed files with 14 additions and 0 deletions

View File

@ -3622,6 +3622,13 @@ class Net_SSH2
*/
function getServerPublicHostKey()
{
if (!($this->bitmap & NET_SSH2_MASK_CONSTRUCTOR)) {
$this->bitmap |= NET_SSH2_MASK_CONSTRUCTOR;
if (!$this->_connect()) {
return false;
}
}
$signature = $this->signature;
$server_public_host_key = $this->server_public_host_key;

View File

@ -58,4 +58,11 @@ class Functional_Net_SSH2Test extends PhpseclibFunctionalTestCase
->will($this->returnValue(true));
$ssh->exec('pwd', array($callbackObject, 'callbackMethod'));
}
public function testGetServerPublicHostKey()
{
$ssh = new Net_SSH2($this->getEnv('SSH_HOSTNAME'));
$this->assertInternalType('string', $ssh->getServerPublicHostKey());
}
}