]> git.mjollnir.org Git - moodle.git/commitdiff
Create DistinguishedName records with a subjectAltName field, and recognise incoming...
authordonal72 <donal72>
Tue, 16 Oct 2007 13:28:45 +0000 (13:28 +0000)
committerdonal72 <donal72>
Tue, 16 Oct 2007 13:28:45 +0000 (13:28 +0000)
mnet/lib.php

index aa6ebf5ce0b3ae61964b32bce6642889eb2cd2d4..e355f0c1c7d41f44b9a8268b52b2f9046a810576 100644 (file)
@@ -79,6 +79,9 @@ function mnet_get_public_key($uri, $application=null) {
         if (strlen(trim($public_certificate))) {
             $credentials = openssl_x509_parse($public_certificate);
             $host = $credentials['subject']['CN'];
+            if (array_key_exists( 'subjectAltName', $credentials['subject'])) {
+                $host = $credentials['subject']['subjectAltName'];
+            }
             if (strpos($uri, $host) !== false) {
                 mnet_set_public_key($uri, $public_certificate);
                 return $public_certificate;
@@ -310,7 +313,8 @@ function mnet_generate_keypair($dn = null, $days=28) {
            "localityName" => $locality,
            "organizationName" => $organization,
            "organizationalUnitName" => 'Moodle',
-           "commonName" => $CFG->wwwroot,
+           "commonName" => substr($CFG->wwwroot, 0, 64),
+           "subjectAltName" => $CFG->wwwroot,
            "emailAddress" => $email
         );
     }