Commit eb4f22fd authored by Lucas Serrano's avatar Lucas Serrano

[digicode] La chaine digicode doit être un entier

On vérifie que le digicode n'envoie pas une chaîne de caractère
non castable en entier.
Causait des plantages à cause du caractère '*'.
parent e867dfe2
......@@ -47,9 +47,13 @@ class VigileHandler(SocketServer.BaseRequestHandler):
# if data starts with o, opened door validation, else should
# be a code
if not data.startswith("o"):
response = requests.post(DIGICODE_LINK, data = {'password' : digicode_pass, 'code' : data}, verify = CERTIFICATE, timeout=0.5)
if response.content == u'Code Successfully Deleted':
socket.sendto("passoir,o=1", self.client_address)
try:
int(data)
response = requests.post(DIGICODE_LINK, data = {'password' : digicode_pass, 'code' : data}, verify = CERTIFICATE, timeout=0.5)
if response.content == u'Code Successfully Deleted':
socket.sendto("passoir,o=1", self.client_address)
except ValueError:
pass
log("%s -- %s" % (data, response.content))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment