1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-30 20:28:08 +00:00

Fixes privileged access checks for IOU.

This commit is contained in:
grossmj 2014-05-22 13:06:29 -06:00
parent 9da5aa1107
commit f2fbdf618f

View File

@ -643,14 +643,13 @@ class IOU(IModule):
nio = NIO_UDP(lport, rhost, rport) nio = NIO_UDP(lport, rhost, rport)
elif request["nio"]["type"] == "nio_tap": elif request["nio"]["type"] == "nio_tap":
tap_device = request["nio"]["tap_device"] tap_device = request["nio"]["tap_device"]
if not self.has_privileged_access(self._iouyap, tap_device): if not has_privileged_access(self._iouyap, tap_device):
raise IOUError("{} has no privileged access to {}.".format(self._iouyap, tap_device)) raise IOUError("{} has no privileged access to {}.".format(self._iouyap, tap_device))
nio = NIO_TAP(tap_device) nio = NIO_TAP(tap_device)
elif request["nio"]["type"] == "nio_generic_ethernet": elif request["nio"]["type"] == "nio_generic_ethernet":
ethernet_device = request["nio"]["ethernet_device"] ethernet_device = request["nio"]["ethernet_device"]
if not self.has_privileged_access(self._iouyap, ethernet_device): if not has_privileged_access(self._iouyap, ethernet_device):
raise IOUError("{} has no privileged access to {}.".format(self._iouyap, ethernet_device)) raise IOUError("{} has no privileged access to {}.".format(self._iouyap, ethernet_device))
self._check_for_privileged_access(ethernet_device)
nio = NIO_GenericEthernet(ethernet_device) nio = NIO_GenericEthernet(ethernet_device)
if not nio: if not nio:
raise IOUError("Requested NIO does not exist or is not supported: {}".format(request["nio"]["type"])) raise IOUError("Requested NIO does not exist or is not supported: {}".format(request["nio"]["type"]))