diff options
author | 2009-06-01 23:15:48 +0000 | |
---|---|---|
committer | 2009-06-01 23:15:48 +0000 | |
commit | c9dc97fd9d42216b5d7a71d0b843cbba9f207220 (patch) | |
tree | 4f2b83e5c6d237000bd5567e4af5ac69b1dcfb69 | |
parent | Whoops, didn't mean to add this. (diff) | |
download | wireguard-openbsd-c9dc97fd9d42216b5d7a71d0b843cbba9f207220.tar.xz wireguard-openbsd-c9dc97fd9d42216b5d7a71d0b843cbba9f207220.zip |
yet another cleanup in mfa/lka, don't roll their own loops to release maps
and rules when config.c provides us with purge_config(), PURGE_MAPS and
PURGE_RULES. kills lots of lines with no functionnal change. ok jacekm@
-rw-r--r-- | usr.sbin/smtpd/lka.c | 46 | ||||
-rw-r--r-- | usr.sbin/smtpd/mfa.c | 44 |
2 files changed, 11 insertions, 79 deletions
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c index b938937bc18..ec043b55d72 100644 --- a/usr.sbin/smtpd/lka.c +++ b/usr.sbin/smtpd/lka.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka.c,v 1.55 2009/06/01 22:51:47 gilles Exp $ */ +/* $OpenBSD: lka.c,v 1.56 2009/06/01 23:15:48 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -204,48 +204,14 @@ lka_dispatch_parent(int sig, short event, void *p) TAILQ_INSERT_TAIL(&m->m_contents, mapel, me_entry); break; } - case IMSG_CONF_END: { - void *temp; - struct rule *r; - struct cond *cond; - struct map *m; - struct mapel *mapel; - + case IMSG_CONF_END: { /* switch and destroy old ruleset */ - temp = env->sc_rules; + if (env->sc_rules) + purge_config(env, PURGE_RULES); + if (env->sc_maps) + purge_config(env, PURGE_MAPS); env->sc_rules = env->sc_rules_reload; - env->sc_rules_reload = temp; - - temp = env->sc_maps; env->sc_maps = env->sc_maps_reload; - env->sc_maps_reload = temp; - - if (env->sc_rules_reload) { - while ((r = TAILQ_FIRST(env->sc_rules_reload))) { - TAILQ_REMOVE(env->sc_rules_reload, r, r_entry); - while ((cond = TAILQ_FIRST(&r->r_conditions))) { - TAILQ_REMOVE(&r->r_conditions, cond, c_entry); - free(cond); - } - free(r); - } - free(env->sc_rules_reload); - env->sc_rules_reload = NULL; - } - - if (env->sc_maps_reload) { - while ((m = TAILQ_FIRST(env->sc_maps_reload))) { - TAILQ_REMOVE(env->sc_maps_reload, m, m_entry); - while ((mapel = TAILQ_FIRST(&m->m_contents))) { - TAILQ_REMOVE(&m->m_contents, mapel, me_entry); - free(mapel); - } - free(m); - } - free(env->sc_maps_reload); - env->sc_maps_reload = NULL; - } - break; } case IMSG_PARENT_FORWARD_OPEN: { diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c index 964750b5d3a..04e0283c2a2 100644 --- a/usr.sbin/smtpd/mfa.c +++ b/usr.sbin/smtpd/mfa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfa.c,v 1.33 2009/06/01 22:51:47 gilles Exp $ */ +/* $OpenBSD: mfa.c,v 1.34 2009/06/01 23:15:48 gilles Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org> @@ -174,47 +174,13 @@ mfa_dispatch_parent(int sig, short event, void *p) break; } case IMSG_CONF_END: { - void *temp; - struct rule *r; - struct cond *cond; - struct map *m; - struct mapel *mapel; - /* switch and destroy old ruleset */ - temp = env->sc_rules; + if (env->sc_rules) + purge_config(env, PURGE_RULES); + if (env->sc_maps) + purge_config(env, PURGE_MAPS); env->sc_rules = env->sc_rules_reload; - env->sc_rules_reload = temp; - - temp = env->sc_maps; env->sc_maps = env->sc_maps_reload; - env->sc_maps_reload = temp; - - if (env->sc_rules_reload) { - while ((r = TAILQ_FIRST(env->sc_rules_reload))) { - TAILQ_REMOVE(env->sc_rules_reload, r, r_entry); - while ((cond = TAILQ_FIRST(&r->r_conditions))) { - TAILQ_REMOVE(&r->r_conditions, cond, c_entry); - free(cond); - } - free(r); - } - free(env->sc_rules_reload); - env->sc_rules_reload = NULL; - } - - if (env->sc_maps_reload) { - while ((m = TAILQ_FIRST(env->sc_maps_reload))) { - TAILQ_REMOVE(env->sc_maps_reload, m, m_entry); - while ((mapel = TAILQ_FIRST(&m->m_contents))) { - TAILQ_REMOVE(&m->m_contents, mapel, me_entry); - free(mapel); - } - free(m); - } - free(env->sc_maps_reload); - env->sc_maps_reload = NULL; - } - break; } default: |