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

tiran commented:

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)

See the full comment at 
Manage your subscription for the Freeipa-devel mailing list:
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to