Skip to content

Support OPT_X_TLS_PEERCERT #427

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

Closed
wants to merge 2 commits into from
Closed

Conversation

tiran
Copy link
Member

@tiran tiran commented Sep 15, 2021

Replaces PR #401

@tiran
Copy link
Member Author

tiran commented Sep 15, 2021

Due to a bug in OpenLDAP, LDAP_OPT_X_TLS_PEERCERT leaks memory: https://bugs.openldap.org/show_bug.cgi?id=9696

@tiran tiran force-pushed the tls_peercert branch 2 times, most recently from f5d29ea to 9863bb7 Compare September 16, 2021 12:01
@tiran tiran marked this pull request as ready for review September 16, 2021 12:02
@tiran tiran requested a review from encukou September 16, 2021 12:03
server_pem = f.read()
# remove text
begin = server_pem.find("-----BEGIN CERTIFICATE-----")
server_pem = server_pem[begin:-1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Is removing the final character important? In our case itdoesn't really matter, but if the file doesn't end with a newline, the exception you get here is a bit obscure.

Suggested change
server_pem = server_pem[begin:-1]
server_pem = server_pem[begin:]

@encukou encukou mentioned this pull request Sep 17, 2021
6 tasks
tiran and others added 2 commits September 18, 2021 17:28
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
Signed-off-by: Christian Heimes <cheimes@redhat.com>
@@ -421,6 +428,33 @@ def test_multiple_starttls(self):
l.simple_bind_s(self.server.root_dn, self.server.root_pw)
self.assertEqual(l.whoami_s(), 'dn:' + self.server.root_dn)

@requires_tls()
@unittest.skipUnless(
hasattr(ldap, "OPT_X_TLS_PEERCERT"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like you still need to register this in Lib/ldap/constants.py to get the tests enabled?

@mistotebe
Copy link
Contributor

Already done as part of #458

@mistotebe mistotebe closed this Apr 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants