[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] Untested) support for REJECTED MMTP response
Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv23067/src/minion/lib/mixminion
Modified Files:
Common.py MMTPClient.py
Log Message:
(Untested) support for REJECTED MMTP response
Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -d -r1.68 -r1.69
--- Common.py 13 Apr 2003 15:50:54 -0000 1.68
+++ Common.py 22 Apr 2003 01:45:22 -0000 1.69
@@ -49,6 +49,10 @@
"""Exception class for MMTP protocol violations"""
pass
+class MixProtocolReject(MixProtocolError):
+ """Exception class for server-rejected packets."""
+ pass
+
class UIError(MixError):
"""Exception raised for an error that should be reported to the user,
not dumped as a stack trace."""
Index: MMTPClient.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/MMTPClient.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- MMTPClient.py 7 Apr 2003 01:14:12 -0000 1.26
+++ MMTPClient.py 22 Apr 2003 01:45:22 -0000 1.27
@@ -22,7 +22,8 @@
import socket
import mixminion._minionlib as _ml
from mixminion.Crypto import sha1, getCommonPRNG
-from mixminion.Common import MixProtocolError, LOG, MixError, formatBase64
+from mixminion.Common import MixProtocolError, MixProtocolReject, LOG, \
+ MixError, formatBase64
class TimeoutError(MixProtocolError):
"""Exception raised for protocol timeout."""
@@ -192,7 +193,10 @@
# And we expect, "RECEIVED\r\n", and sha1(packet|"RECEIVED")
inp = self.tls.read(len(serverControl)+20)
- if inp != serverControl+sha1(packet+serverHashExtra):
+ if inp == "REJECTED\r\n"+sha1(packet+"REJECTED"):
+ raise MixProtocolReject()
+ elif inp != serverControl+sha1(packet+serverHashExtra):
+ LOG.warn("Received bad ACK from server")
raise MixProtocolError("Bad ACK received")
LOG.debug("ACK received; packet successfully delivered")
except (socket.error, _ml.TLSError), e: