From a626b8e164b377eaa71024951748a0e8225f8813 Mon Sep 17 00:00:00 2001 From: Alex 'AdUser' Z Date: Wed, 5 Oct 2016 15:50:09 +1000 Subject: [PATCH] * source/portknock : implement stop() & destroy() --- src/sources/portknock.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/sources/portknock.c b/src/sources/portknock.c index dd2ac4b..ed66945 100644 --- a/src/sources/portknock.c +++ b/src/sources/portknock.c @@ -176,7 +176,9 @@ bool stop(cfg_t *cfg) { assert(cfg != NULL); - /* TODO */ + for (f2b_port_t *port = cfg->ports; port != NULL; port = port->next) + close(port->sock); + return true; } @@ -192,7 +194,13 @@ next(cfg_t *cfg, char *buf, size_t bufsize, bool reset) { void destroy(cfg_t *cfg) { + f2b_port_t *next; assert(cfg != NULL); + for (; cfg->ports != NULL; cfg->ports = next) { + next = cfg->ports->next; + free(cfg->ports); + } + free(cfg); }