Skip to content

Commit

Permalink
raise ldap.PROTOCOL_ERROR if compare operation returned a wrong result
Browse files Browse the repository at this point in the history
  • Loading branch information
stroeder authored and Petr Viktorin committed Nov 22, 2017
1 parent 2e88535 commit 1c26ef1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Lib/ldap/ldapobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,14 @@ def compare_ext(self,dn,attr,value,serverctrls=None,clientctrls=None):
def compare_ext_s(self,dn,attr,value,serverctrls=None,clientctrls=None):
msgid = self.compare_ext(dn,attr,value,serverctrls,clientctrls)
try:
resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all=1,timeout=self.timeout)
ldap_res = self.result3(msgid,all=1,timeout=self.timeout)
except ldap.COMPARE_TRUE:
return 1
except ldap.COMPARE_FALSE:
return 0
return None
raise ldap.PROTOCOL_ERROR(
'Compare operation returned wrong result: %r' % (ldap_res)
)

def compare(self,dn,attr,value):
return self.compare_ext(dn,attr,value,None,None)
Expand Down

0 comments on commit 1c26ef1

Please sign in to comment.