Skip to content

Commit

Permalink
mechanism: Do not use eval to retrieve dhcpd handler class
Browse files Browse the repository at this point in the history
See #416
  • Loading branch information
infirit committed Dec 18, 2015
1 parent 27a1d89 commit a3845bb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion blueman/plugins/mechanism/Network.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from gi.repository import GObject
from blueman.main.NetConf import NetConf, DnsMasqHandler, DhcpdHandler

DHCPDHANDLERS = {"DnsMasqHandler": DnsMasqHandler,
"DhcpdHandler": DhcpdHandler},

class Network(MechanismPlugin):
@dbus.service.method('org.blueman.Mechanism', in_signature="s", out_signature="s", sender_keyword="caller",
Expand Down Expand Up @@ -53,7 +55,7 @@ def SetGN(self, enabled, caller):
def EnableNetwork(self, ip_address, netmask, dhcp_handler, caller):
nc = NetConf.get_default()
nc.set_ipv4(ip_address, netmask)
eval("nc.set_dhcp_handler(%s)" % dhcp_handler)
nc.set_dhcp_handler(DHCPDHANDLERS[dhcp_handler])
nc.apply_settings()

@dbus.service.method('org.blueman.Mechanism', in_signature="", out_signature="", sender_keyword="caller")
Expand Down

0 comments on commit a3845bb

Please sign in to comment.