Explicitly *remove* STS policy when we get a duration of 0
This commit is contained in:
parent
5fa442c8a5
commit
3fa16fe678
1 changed files with 9 additions and 5 deletions
|
@ -5,16 +5,20 @@ class Module(ModuleManager.BaseModule):
|
||||||
def _set_policy(self, server, port, duration, one_shot):
|
def _set_policy(self, server, port, duration, one_shot):
|
||||||
expiration = None
|
expiration = None
|
||||||
if duration:
|
if duration:
|
||||||
expiration = time.time()+int(duration)
|
expiration = time.time()+duration
|
||||||
server.set_setting("sts-policy", {
|
server.set_setting("sts-policy", {
|
||||||
"port": port,
|
"port": port,
|
||||||
"expiration": expiration,
|
"expiration": expiration,
|
||||||
"one-shot": one_shot})
|
"one-shot": one_shot})
|
||||||
def _change_duration(self, server, info):
|
def _change_duration(self, server, info):
|
||||||
|
duration = int(info["duration"])
|
||||||
|
if duration == 0:
|
||||||
|
server.del_setting("sts-policy")
|
||||||
|
else:
|
||||||
port = event["server"].port
|
port = event["server"].port
|
||||||
if "port" in info:
|
if "port" in info:
|
||||||
port = int(info["port"])
|
port = int(info["port"])
|
||||||
self._set_policy(server, port, info["duration"], False)
|
self._set_policy(server, port, duration, False)
|
||||||
|
|
||||||
@utils.hook("received.cap.ls")
|
@utils.hook("received.cap.ls")
|
||||||
def on_cap_ls(self, event):
|
def on_cap_ls(self, event):
|
||||||
|
|
Loading…
Reference in a new issue