From b89c34aacfcde984b0395ffc0b0fbf8e3361cb03 Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 7 Jan 2011 21:37:20 +0000 Subject: Ticket #621. sort the contents of array used for generating subject by keys so whenever we do subject comparison we will not have problem just because of the array keys ordering. --- etc/inc/certs.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc index e82baba..03371fd 100644 --- a/etc/inc/certs.inc +++ b/etc/inc/certs.inc @@ -307,13 +307,15 @@ function cert_get_subject($str_crt, $decode = true) { if (!is_array($components)) return "unknown"; + ksort($components); foreach ($components as $a => $v) { - if (is_array($v)) + if (is_array($v)) { + ksort($v); foreach ($v as $w) { $asubject = "{$a}={$w}"; $subject = (strlen($subject)) ? "{$asubject}, {$subject}" : $asubject; } - else { + } else { $asubject = "{$a}={$v}"; $subject = (strlen($subject)) ? "{$asubject}, {$subject}" : $asubject; } @@ -561,4 +563,4 @@ function is_crl_internal($crl) { return !(!empty($crl['text']) && empty($crl['cert'])); } -?> \ No newline at end of file +?> -- cgit v1.1