Skip to content

Commit 5197e58

Browse files
tiranencukou
authored andcommitted
Add reproducer for NSS callback issue
The new test case simply creates 10 connections and calls start_tls_s() after OPT_X_TLS_NEWCTX. python-ldap#134 See: python-ldap#60 Signed-off-by: Christian Heimes <cheimes@redhat.com>
1 parent 4bc1f58 commit 5197e58

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

Tests/t_ldapobject.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import warnings
2424
import pickle
2525
import warnings
26-
from slapdtest import SlapdTestCase, requires_sasl
26+
from slapdtest import SlapdTestCase, requires_sasl, requires_tls
2727

2828
# Switch off processing .ldaprc or ldap.conf before importing _ldap
2929
os.environ['LDAPNOINIT'] = '1'
@@ -418,6 +418,20 @@ def test_byteswarning_initialize(self):
418418
self._check_byteswarning(
419419
w[0], u"Under Python 2, python-ldap uses bytes by default.")
420420

421+
@requires_tls()
422+
def test_multiple_starttls(self):
423+
# Test for openldap does not re-register nss shutdown callbacks
424+
# after nss_Shutdown is called
425+
# https://github.com/python-ldap/python-ldap/issues/60
426+
# https://bugzilla.redhat.com/show_bug.cgi?id=1520990
427+
for _ in range(10):
428+
l = self.ldap_object_class(self.server.ldap_uri)
429+
l.set_option(ldap.OPT_X_TLS_CACERTFILE, self.server.cafile)
430+
l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
431+
l.start_tls_s()
432+
l.simple_bind_s(self.server.root_dn, self.server.root_pw)
433+
self.assertEqual(l.whoami_s(), 'dn:' + self.server.root_dn)
434+
421435

422436
class Test01_ReconnectLDAPObject(Test00_SimpleLDAPObject):
423437
"""

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy