# HG changeset patch # User Edouard Tisserant # Date 1540294567 -7200 # Node ID 0a3103cd825d91440e9417b1bb7fb18a85d007b2 # Parent dd959601e67a089391fc29f7b2cb9541346c531d Small cosmetic change to enhance readability and avoid confusion. diff -r dd959601e67a -r 0a3103cd825d Beremiz_service.py --- a/Beremiz_service.py Tue Oct 23 13:34:15 2018 +0200 +++ b/Beremiz_service.py Tue Oct 23 13:36:07 2018 +0200 @@ -334,9 +334,9 @@ self.pyroserver.Restart() def OnTaskBarChangeName(self, evt): - servicename = self.pyroserver.servicename - servicename = '' if servicename is None else servicename - dlg = ParamsEntryDialog(None, _("Enter a name "), defaultValue=servicename) + _servicename = self.pyroserver.servicename + _servicename = '' if _servicename is None else _servicename + dlg = ParamsEntryDialog(None, _("Enter a name "), defaultValue=_servicename) dlg.SetTests([(lambda name: len(name) is not 0, _("Name must not be null!"))]) if dlg.ShowModal() == wx.ID_OK: self.pyroserver.servicename = dlg.GetValue() diff -r dd959601e67a -r 0a3103cd825d runtime/Stunnel.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/runtime/Stunnel.py Tue Oct 23 13:36:07 2018 +0200 @@ -0,0 +1,18 @@ +import os +from binascii import hexlify + +restart_stunnel_cmdline = ["/etc/init.d/S50stunnel","restart"] + +def pskgen(ID, pskpath): + secretstring = hexlify(os.urandom(256)) + pskstring = ID+":"+secretstring + with open(pskpath, 'w') as f: + f.write(pskstring) + call(restart_stunnel_cmdline) + +def ensurepsk(ID, pskpath): + # check if already there + if not os.path.exists(pskpath): + # create if needed + pskgen(IS, pskpath) +