diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-06-01 23:15:49 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2009-06-01 23:15:49 +0000 |
commit | 8e59d0ae88c89cc8f8d1c0586801b1c9126d0248 (patch) | |
tree | 5433f636b2a99e04acce66a39b0921652390cc13 /usr.sbin/smtpd/lka.c | |
parent | 021ed6aef2f290bc0c570d8e176aa431221bf580 (diff) |
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@
Diffstat (limited to 'usr.sbin/smtpd/lka.c')
-rw-r--r-- | usr.sbin/smtpd/lka.c | 46 |
1 files changed, 6 insertions, 40 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: { |