[Freeipa-devel] [freeipa PR#436][comment] x509: allow leading text in PEM files

tiran freeipa-github-notification at redhat.com
Mon Feb 6 11:56:53 UTC 2017


  URL: https://github.com/freeipa/freeipa/pull/436
Title: #436: x509: allow leading text in PEM files

tiran commented:
"""
NACK

The ^ is correct because the regular expression must search for a line that starts with ```-----BEGIN CERTIFICATE-----```. I cannot reproduce the issue locally. The regexp matches a cert with leading text:

```
>>> import re
>>> regexp = u"^-----BEGIN CERTIFICATE-----(.*?)-----END CERTIFICATE-----"
>>> pem = u"leading line\n-----BEGIN CERTIFICATE-----\nabcd\n-----END CERTIFICATE-----\ntrailing text"
>>> re.search(regexp, pem, re.MULTILINE | re.DOTALL)
<_sre.SRE_Match object at 0x7f667778d0a8>
>>> re.search(regexp, pem, re.MULTILINE | re.DOTALL).group(1)
u'\nabcd\n'
```
"""

See the full comment at https://github.com/freeipa/freeipa/pull/436#issuecomment-277661149


More information about the Freeipa-devel mailing list