diff options
| author | 2018-11-05 13:26:11 +0000 | |
|---|---|---|
| committer | 2018-11-05 13:26:11 +0000 | |
| commit | 3fa16fe678acabe7e26ca9f87fda57f554d8a968 (patch) | |
| tree | 6f61853fdb22bcce85ddf4df032953b802d6324c | |
| parent | `info` does not exist in on_cap_new context in modules/sts.py (diff) | |
| signature | ||
Explicitly *remove* STS policy when we get a duration of 0
| -rw-r--r-- | modules/sts.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/modules/sts.py b/modules/sts.py index c12ee01f..c16e8214 100644 --- a/modules/sts.py +++ b/modules/sts.py @@ -5,16 +5,20 @@ class Module(ModuleManager.BaseModule): def _set_policy(self, server, port, duration, one_shot): expiration = None if duration: - expiration = time.time()+int(duration) + expiration = time.time()+duration server.set_setting("sts-policy", { "port": port, "expiration": expiration, "one-shot": one_shot}) def _change_duration(self, server, info): - port = event["server"].port - if "port" in info: - port = int(info["port"]) - self._set_policy(server, port, info["duration"], False) + duration = int(info["duration"]) + if duration == 0: + server.del_setting("sts-policy") + else: + port = event["server"].port + if "port" in info: + port = int(info["port"]) + self._set_policy(server, port, duration, False) @utils.hook("received.cap.ls") def on_cap_ls(self, event): |
