Skip to content

Commit

Permalink
Merge branch '2.x' into 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
frankdejonge committed Apr 14, 2022
2 parents dea7299 + 837431d commit 9b3b146
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@
* FilesystemAdapter::directoryExists to check for directory existence
* FilesystemAdapter::fileExists to check for file existence

## 2.4.4 - 2022-04-14

### Fixed

- [SFTP v2] Avoid type errors when public key is not retrieved (#1446)
- [SFTP v3] Avoid type errors when public key is not retrieved (#1446)

## 2.4.3 - 2022-02-16

### Fixed
Expand Down
7 changes: 6 additions & 1 deletion src/PhpseclibV2/SftpConnectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,12 @@ private function checkFingerprint(SFTP $connection): void
return;
}

$publicKey = $connection->getServerPublicHostKey() ?: 'no-public-key';
$publicKey = $connection->getServerPublicHostKey();

if ($publicKey === false) {
throw UnableToEstablishAuthenticityOfHost::becauseTheAuthenticityCantBeEstablished($this->host);
}

$fingerprint = $this->getFingerprintFromPublicKey($publicKey);

if (0 !== strcasecmp($this->hostFingerprint, $fingerprint)) {
Expand Down
7 changes: 6 additions & 1 deletion src/PhpseclibV3/SftpConnectionProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ private function checkFingerprint(SFTP $connection): void
return;
}

$publicKey = $connection->getServerPublicHostKey() ?: 'no-public-key';
$publicKey = $connection->getServerPublicHostKey();

if ($publicKey === false) {
throw UnableToEstablishAuthenticityOfHost::becauseTheAuthenticityCantBeEstablished($this->host);
}

$fingerprint = $this->getFingerprintFromPublicKey($publicKey);

if (0 !== strcasecmp($this->hostFingerprint, $fingerprint)) {
Expand Down

0 comments on commit 9b3b146

Please sign in to comment.