Skip to content

Commit b51740e

Browse files
committed
Claim ownership of socket once we've passed it to libldap
Fixes: python-ldap#460 Closes: python-ldap#543
1 parent 2229d83 commit b51740e

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

Tests/t_ldapobject.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -649,22 +649,14 @@ class Test03_SimpleLDAPObjectWithFileno(Test00_SimpleLDAPObject):
649649
def _open_ldap_conn(self, who=None, cred=None, **kwargs):
650650
if hasattr(self, '_sock'):
651651
raise RuntimeError("socket already connected")
652-
self._sock = socket.create_connection(
652+
sock = socket.create_connection(
653653
(self.server.hostname, self.server.port)
654654
)
655-
return super()._open_ldap_conn(
656-
who=who, cred=cred, fileno=self._sock.fileno(), **kwargs
655+
result = super()._open_ldap_conn(
656+
who=who, cred=cred, fileno=sock.fileno(), **kwargs
657657
)
658-
659-
def tearDown(self):
660-
self._sock.close()
661-
delattr(self, '_sock')
662-
super().tearDown()
663-
664-
def reset_connection(self):
665-
self._sock.close()
666-
delattr(self, '_sock')
667-
super(Test03_SimpleLDAPObjectWithFileno, self).reset_connection()
658+
sock.detach()
659+
return result
668660

669661

670662
if __name__ == '__main__':

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