Permalink
Browse files

mnet MDL-14117 truncate values in $dn to the RFC 3280 lengths when ma…

…king new mnet keys
  • Loading branch information...
Penny Leach
Penny Leach committed Feb 18, 2010
1 parent da92b21 commit 25cd4deb3a7c137f57baf8691d4eda4343d9ca5e
Showing with 14 additions and 0 deletions.
  1. +14 −0 mnet/lib.php
View
@@ -354,6 +354,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"]);

0 comments on commit 25cd4de

Please sign in to comment.