Skip to content

Commit bad14b5

Browse files
author
stroeder
committed
raise ldap.PROTOCOL_ERROR if compare operation returned a wrong result
1 parent 956c961 commit bad14b5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Lib/ldap/ldapobject/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ def compare_ext(self, dn, attr, value, serverctrls=None, clientctrls=None):
425425
def compare_ext_s(self, dn, attr, value, serverctrls=None, clientctrls=None):
426426
msgid = self.compare_ext(dn, attr, value, serverctrls, clientctrls)
427427
try:
428-
resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(
428+
ldap_res = self.result3(
429429
msgid,
430430
all=1,
431431
timeout=self.timeout
@@ -434,7 +434,9 @@ def compare_ext_s(self, dn, attr, value, serverctrls=None, clientctrls=None):
434434
return True
435435
except ldap.COMPARE_FALSE:
436436
return False
437-
return None
437+
raise ldap.PROTOCOL_ERROR(
438+
'Compare operation returned wrong result: %r' % (ldap_res)
439+
)
438440

439441
def compare(self, dn, attr, value):
440442
return self.compare_ext(dn, attr, value, None, None)

0 commit comments

Comments
 (0)