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-04 17:12:01 +01:00
parent 80b09028d1
commit 89d1a3f83b
+1 -1
View File
@@ -174,7 +174,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));