From: Bernard Blackham Date: Sun, 31 Oct 2004 09:29:05 +0000 (+0000) Subject: fix stupid crypto bug X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=2ecb73b29de6405ca4df56ec219c685b7de963df;p=zanchey%2Fdispense2.git fix stupid crypto bug --- diff --git a/sql-edition/servers/VendingMachine.py b/sql-edition/servers/VendingMachine.py index 4a40922..d7e7a8f 100644 --- a/sql-edition/servers/VendingMachine.py +++ b/sql-edition/servers/VendingMachine.py @@ -44,6 +44,7 @@ class VendingMachine: except socket.error: raise VendingException('failed to read input from vending machine') if s == '': raise VendingException('nothing read!') + if (s != '#' and s != '%') and state == 1: prefix += s if s == '\n' or s == '\r': state = 1 prefix = '' @@ -114,7 +115,7 @@ class VendingMachine: def vend(self, item): if not re.search('^[0-9][0-9]$', item): return (False, 'Invalid item requested (%s)'%item) - self.wfh.write(self.authed_message(('V%s\n'%item)+'\n')) + self.wfh.write(self.authed_message(('V%s'%item))+'\n') (code, string) = self.get_response() return (code == '100', code, string)