Skip to content

Commit 8a65862

Browse files
spaceonedroideck
authored andcommitted
fix(controls): make sure msg_id is not undefined in error case
1 parent 73b3ec3 commit 8a65862

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Lib/ldap/controls/openldap.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class SearchNoOpMixIn:
5151
"""
5252

5353
def noop_search_st(self,base,scope=ldap.SCOPE_SUBTREE,filterstr='(objectClass=*)',timeout=-1):
54+
msg_id = None
5455
try:
5556
msg_id = self.search_ext(
5657
base,
@@ -66,9 +67,10 @@ def noop_search_st(self,base,scope=ldap.SCOPE_SUBTREE,filterstr='(objectClass=*)
6667
ldap.TIMELIMIT_EXCEEDED,
6768
ldap.SIZELIMIT_EXCEEDED,
6869
ldap.ADMINLIMIT_EXCEEDED
69-
) as e:
70-
self.abandon(msg_id)
71-
raise e
70+
):
71+
if msg_id is not None:
72+
self.abandon(msg_id)
73+
raise
7274
else:
7375
noop_srch_ctrl = [
7476
c

0 commit comments

Comments
 (0)