X509: fix typo: improve new DN attrs handling.

This commit is contained in:
Patrick Monnerat 2012-09-27 15:15:12 +02:00
parent 29b9642965
commit 1377d56a4e

View File

@ -1814,7 +1814,7 @@ class File_X509 {
return 'id-at-role'; return 'id-at-role';
case 'id-at-uniqueidentifier': case 'id-at-uniqueidentifier':
case 'uniqueidentifier': case 'uniqueidentifier':
case 'x509uniqueidentifier': case 'x500uniqueidentifier':
return 'id-at-uniqueIdentifier'; return 'id-at-uniqueIdentifier';
default: default:
return false; return false;
@ -1933,7 +1933,7 @@ class File_X509 {
} }
// handles everything else // handles everything else
$results = preg_split('#((?:^|, |/)(?:C=|O=|OU=|CN=|L=|ST=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=))#', $dn, -1, PREG_SPLIT_DELIM_CAPTURE); $results = preg_split('#((?:^|, |/)(?:C=|O=|OU=|CN=|L=|ST=|SN=|postalCode=|streetAddress=|emailAddress=|serialNumber=|organizationalUnitName=|title=|description=|role=|x500UniqueIdentifier=))#', $dn, -1, PREG_SPLIT_DELIM_CAPTURE);
for ($i = 1; $i < count($results); $i+=2) { for ($i = 1; $i < count($results); $i+=2) {
$type = trim($results[$i], ', =/'); $type = trim($results[$i], ', =/');
$value = $results[$i + 1]; $value = $results[$i + 1];
@ -1987,6 +1987,13 @@ class File_X509 {
case 'id-at-localityName': case 'id-at-localityName':
$desc = 'L='; $desc = 'L=';
break; break;
case 'id-at-surname':
$desc = 'SN=';
break;
case 'id-at-uniqueIdentifier':
$delim = '/';
$desc = 'x500UniqueIdentifier=';
break;
default: default:
$delim = '/'; $delim = '/';
$desc = preg_replace('#.+-([^-]+)$#', '$1', $type) . '='; $desc = preg_replace('#.+-([^-]+)$#', '$1', $type) . '=';