Show More
@@ -27,6 +27,13 b' except:' | |||
|
27 | 27 | cPickle = None |
|
28 | 28 | import pickle |
|
29 | 29 | |
|
30 | try: | |
|
31 | from hmac import compare_digest | |
|
32 | except ImportError: | |
|
33 | # Python < 2.7.7 | |
|
34 | def compare_digest(a,b): | |
|
35 | return a == b | |
|
36 | ||
|
30 | 37 | import zmq |
|
31 | 38 | from zmq.utils import jsonapi |
|
32 | 39 | from zmq.eventloop.ioloop import IOLoop |
@@ -818,7 +825,7 b' class Session(Configurable):' | |||
|
818 | 825 | raise ValueError("Duplicate Signature: %r" % signature) |
|
819 | 826 | self._add_digest(signature) |
|
820 | 827 | check = self.sign(msg_list[1:5]) |
|
821 |
if not |
|
|
828 | if not compare_digest(signature, check): | |
|
822 | 829 | raise ValueError("Invalid Signature: %r" % signature) |
|
823 | 830 | if not len(msg_list) >= minlen: |
|
824 | 831 | raise TypeError("malformed message, must have at least %i elements"%minlen) |
General Comments 0
You need to be logged in to leave comments.
Login now