8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-23 15:33:45 +00:00

Fix searching for malformated IP or MAC addresses in machine history search

This commit is contained in:
Jean-Romain Garnier 2020-04-24 23:09:15 +02:00 committed by chirac
parent 364f89d3d4
commit a659e2fcbd

View file

@ -27,6 +27,7 @@ from django.contrib.auth.models import Group
from django.db.models import Q
from django.apps import apps
from netaddr import EUI
macaddress.fields import default_dialect
from machines.models import IpList
from machines.models import Interface
@ -156,12 +157,12 @@ class MachineHistorySearch:
pass
elif search_type == "mac":
try:
search = EUI(search)
search = EUI(search, dialect=default_dialect())
return self._get_by_mac(search)[::-1]
except:
pass
return None
return []
def _add_revision(self, user, machine, interface):
"""