summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2018-12-21 17:31:58 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2018-12-21 17:31:58 +0000
commit2141ce5f7d2334c64c6767179cf0a1ebc10cd757 (patch)
tree93169546dec65c65b49fbffc9e9e3e336bc43f4f /usr.sbin
parentff915bbec2e796fa5f3af948fa131bee45253bcd (diff)
in lka_filter_init(), split into two passes, one to deal with filters then
another one to associate filters to chains
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/smtpd/lka_filter.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c
index 19a7b66700f..a33046504cc 100644
--- a/usr.sbin/smtpd/lka_filter.c
+++ b/usr.sbin/smtpd/lka_filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_filter.c,v 1.18 2018/12/21 17:22:50 gilles Exp $ */
+/* $OpenBSD: lka_filter.c,v 1.19 2018/12/21 17:31:57 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -157,15 +157,27 @@ lka_filter_init(void)
break;
case FILTER_TYPE_CHAIN:
+ break;
+ }
+ }
+
+ iter = NULL;
+ while (dict_iter(env->sc_filters_dict, &iter, &name, (void **)&filter_config)) {
+ switch (filter_config->filter_type) {
+ case FILTER_TYPE_CHAIN:
filter = xcalloc(1, sizeof(*filter));
filter->name = name;
filter->chain = xcalloc(filter_config->chain_size, sizeof(void **));
filter->chain_size = filter_config->chain_size;
filter->config = filter_config;
for (i = 0; i < filter->chain_size; ++i)
- filter->chain[i] = dict_get(&filters, filter_config->chain[i]);
+ filter->chain[i] = dict_xget(&filters, filter_config->chain[i]);
dict_set(&filters, name, filter);
break;
+
+ case FILTER_TYPE_BUILTIN:
+ case FILTER_TYPE_PROC:
+ break;
}
}
}
@@ -232,6 +244,7 @@ lka_filter_ready(void)
}
continue;
}
+
for (i = 0; i < nitems(filter_execs); ++i) {
if (filter->phases & (1<<i)) {
filter_entry = xcalloc(1, sizeof *filter_entry);