mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-25 11:20:03 +00:00
Merge pull request #380 from terrafrost/server-host-key
SSH2: make it so you can verify server public host key without logging on * terrafrost/server-host-key: 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:
commit
9716d9b7e5
@ -3625,6 +3625,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;
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user