Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x509: allow leading text in PEM files #436

Closed
wants to merge 1 commit into from
Closed

x509: allow leading text in PEM files #436

wants to merge 1 commit into from

Conversation

HonzaCholasta
Copy link
Contributor

@HonzaCholasta HonzaCholasta commented Feb 6, 2017

This fixes a regression introduced in commit
b8d6524.

https://fedorahosted.org/freeipa/ticket/4985

@MartinBasti MartinBasti self-assigned this Feb 6, 2017
@tiran
Copy link
Member

tiran commented Feb 6, 2017

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'

@HonzaCholasta
Copy link
Contributor Author

Oops, didn't realize that ^ matches beginning of each line in multiline mode. I think we can keep the test, though.

@tiran
Copy link
Member

tiran commented Feb 6, 2017

Yes, please keep the test. It should pass with the current regular expression, too.

@tiran tiran added the ack Pull Request approved, can be merged label Feb 6, 2017
@HonzaCholasta HonzaCholasta added the pushed Pull Request has already been pushed label Feb 6, 2017
@HonzaCholasta
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
3 participants