From 7c3379cae4ca6e0fbe09db062aaa31511ab6efe7 Mon Sep 17 00:00:00 2001 From: Bernard Blackham Date: Sun, 31 Oct 2004 09:29:05 +0000 Subject: [PATCH] fix stupid crypto bug --- sql-edition/servers/VendingMachine.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) -- 2.20.1