1
0
Fork 0

Reuse new TlsHelper for CA validation, refs #4798

pull/4775/head
Jordi Boggiano 2016-01-25 19:17:56 +00:00
parent 1ea810d40b
commit bdb97e7527
1 changed files with 13 additions and 9 deletions

View File

@ -383,6 +383,7 @@ class RemoteFilesystem
}
}
// Handle SSL cert match issues
if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
// Certificate name error, PHP doesn't support subjectAltName on PHP < 5.6
// The procedure to handle sAN for older PHP's is:
@ -421,9 +422,11 @@ class RemoteFilesystem
$result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
if (false !== $this->storeAuth) {
$authHelper = new AuthHelper($this->io, $this->config);
$authHelper->storeAuth($this->originUrl, $this->storeAuth);
$this->storeAuth = false;
}
return $result;
}
@ -916,11 +919,12 @@ class RemoteFilesystem
// assume the CA is valid if php is vulnerable to
// https://www.sektioneins.de/advisories/advisory-012013-php-openssl_x509_parse-memory-corruption-vulnerability.html
if (
PHP_VERSION_ID <= 50327
|| (PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50422)
|| (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50506)
) {
if (!TlsHelper::isOpensslParseSafe()) {
$this->io->writeError(sprintf(
'<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
PHP_VERSION
));
return $files[$filename] = !empty($contents);
}