MDL-52766 mnet: Support MNet peer URLs longer than 64 characters

The commonName in SSL certificate is limited to 64 characters as per
RFC 5280 (https://www.ietf.org/rfc/rfc5280.txt). We respect that limit
when generating the CN attribute from the site's $CFG->wwwroot. But then
we did not respect it when comparing the common name with the peer's
URL so the certificate was not considered valid.
This commit is contained in:
David Mudrák 2016-02-02 22:34:04 +01:00
parent 9d5d9c64ff
commit 511f8c46b7

View File

@ -170,7 +170,7 @@ class mnet_peer {
$a['host'] = $this->wwwroot;
$this->error[] = array('code' => 5, 'text' => get_string("nonmatchingcert", 'mnet', $a));
return false;
} elseif ($credentials['subject']['CN'] != $this->wwwroot) {
} else if ($credentials['subject']['CN'] !== substr($this->wwwroot, 0, 64)) {
$a['subject'] = $credentials['subject']['CN'];
$a['host'] = $this->wwwroot;
$this->error[] = array('code' => 4, 'text' => get_string("nonmatchingcert", 'mnet', $a));