Skip to content

Commit

Permalink
mnet MDL-14117 truncate values in $dn to the RFC 3280 lengths when ma…
Browse files Browse the repository at this point in the history
…king new mnet keys

merged from MOODLE_19_STABLE
  • Loading branch information
Penny Leach committed Feb 18, 2010
1 parent b257d7c commit fd19724
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions mnet/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,20 @@ function mnet_generate_keypair($dn = null, $days=28) {
);
}

$dnlimits = array(
'countryName' => 2,
'stateOrProvinceName' => 128,
'localityName' => 128,
'organizationName' => 64,
'organizationalUnitName' => 64,
'commonName' => 64,
'emailAddress' => 128
);

foreach ($dnlimits as $key => $length) {
$dn[$key] = substr($dn[$key], 0, $length);
}

// ensure we remove trailing slashes
$dn["commonName"] = preg_replace(':/$:', '', $dn["commonName"]);
if (!empty($CFG->opensslcnf)) { //allow specification of openssl.cnf especially for Windows installs
Expand Down

0 comments on commit fd19724

Please sign in to comment.