https://bugs.contribs.org/show_bug.cgi?id=11436

            Bug ID: 11436
           Summary: phpki-ng certificate matching
    Classification: Contribs
           Product: SME Contribs
           Version: 10beta
          Hardware: ---
                OS: ---
            Status: CONFIRMED
          Severity: normal
          Priority: P3
         Component: phpki-ng
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

While trying to debug a preg_match issue in openssl_functions I notice there
are a couple of match issues

    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext)
&& preg_match('~Code Signing~', $certtext)) {
        $cert_type = 'email_signing';
    }

    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext))
{
        $cert_type = 'email';
    }

If $certtext contains just 'E-mail' the $cert_type get set as 'email'

But if $certtext contains E-mail and Code Signing it first gets set as
email_signing, and then as email.

These should probably the other way round eg

    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext))
{
        $cert_type = 'email';
    }

    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext)
&& preg_match('~Code Signing~', $certtext)) {
        $cert_type = 'email_signing';
    }





However, further down in function CA_cert_type($serial) we then haver this


    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext)
&& preg_match('~Code Signing~', $certtext)) {
        $cert_type = 'email_signing'; // This was email_code signing but think
that is wrong
    }
    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext))
{
        $cert_type = 'email';
    } 
    elseif (preg_match('~OpenSSL.* Server .*Certificate~', $certtext)) {
        $cert_type = 'server';
    } 
    elseif (preg_match('~timeStamping|Time Stamping~', $certtext)) {
        $cert_type = 'time_stamping';
    } elsif......

I would suggest removing the elsifs or setting this at the top??

    if (preg_match('~OpenSSL.* (E.?mail|Personal) .*Certificate~', $certtext))
{
        $cert_type = 'email';

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
You are the assignee for the bug.
_______________________________________________
Mail for each SME Contribs bug report
To unsubscribe, e-mail [email protected]
Searchable archive at https://lists.contribs.org/mailman/public/contribteam/

Reply via email to