Skip to content

Further improve X500 addresses detection, don't overwrite existing address but do retain X500 address if available #73

@sanastasiadis

Description

@sanastasiadis

To detect X500 addresses, the regular expression is used: "/o=[^/]+/ou=[^/]+(?:/cn=[^/]+)?"
This regular expression accepts only one appearance of "cn=".

It is possible to have X500 addresses with multiple "cn=" parts, eg: "/o=Test/ou=Unit/cn=Recipients/cn=anassta".
In this case the above regular expression will not work.

Proposed solution is to change the regular expression to search for "one or more" "cn=" parts, by changing the final "?" into "+".
Eg: "/o=[^/]+/ou=[^/]+(?:/cn=[^/]+)+".

I tested with the proposed regular expression and it works for both cases:

  1. "/o=Test/ou=Unit/cn=Recipients/cn=anassta"
  2. "/o=Test/ou=Unit/cn=anassta"

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions