aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Chehade <gilles@poolp.org>2018-12-21 23:08:42 +0100
committerGilles Chehade <gilles@poolp.org>2018-12-21 23:08:42 +0100
commit136f515779188b9e4bf27ad613cd9810b26fb65f (patch)
treede67aefd2b8a85933d59105769961ba1e2f6eedf
parentsplit lka_filter_init() in two passes (diff)
downloadOpenSMTPD-136f515779188b9e4bf27ad613cd9810b26fb65f.tar.xz
OpenSMTPD-136f515779188b9e4bf27ad613cd9810b26fb65f.zip
bleh
-rw-r--r--smtpd/lka_filter.c9
-rw-r--r--smtpd/lka_proc.c3
-rw-r--r--smtpd/parse.y4
3 files changed, 11 insertions, 5 deletions
diff --git a/smtpd/lka_filter.c b/smtpd/lka_filter.c
index a3304650..3481cf0d 100644
--- a/smtpd/lka_filter.c
+++ b/smtpd/lka_filter.c
@@ -264,7 +264,9 @@ lka_filter_proc_in_session(uint64_t reqid, const char *proc)
struct filter *filter;
size_t i;
- fs = tree_xget(&sessions, reqid);
+ if ((fs = tree_get(&sessions, reqid)) == NULL)
+ return 0;
+
filter = dict_get(&filters, fs->filter_name);
if (filter->proc == NULL && filter->chain == NULL)
@@ -591,7 +593,10 @@ filter_data_next(uint64_t token, uint64_t reqid, const char *line)
struct filter_entry *filter_entry;
struct filter *filter;
- fs = tree_xget(&sessions, reqid);
+ /* client session may have disappeared since we started streaming data */
+ if ((fs = tree_get(&sessions, reqid)) == NULL)
+ return;
+
filter_chain = dict_get(&filter_chains, fs->filter_name);
TAILQ_FOREACH(filter_entry, &filter_chain->chain[fs->phase], entries)
diff --git a/smtpd/lka_proc.c b/smtpd/lka_proc.c
index 90fe9dbb..2b34e7a7 100644
--- a/smtpd/lka_proc.c
+++ b/smtpd/lka_proc.c
@@ -73,6 +73,9 @@ lka_proc_forked(const char *name, int fd)
processor = xcalloc(1, sizeof *processor);
processor->name = xstrdup(name);
processor->io = io_new();
+
+ io_set_nonblocking(fd);
+
io_set_fd(processor->io, fd);
io_set_callback(processor->io, processor_io, processor->name);
dict_xset(&processors, name, processor);
diff --git a/smtpd/parse.y b/smtpd/parse.y
index 8b4461e8..400afbf4 100644
--- a/smtpd/parse.y
+++ b/smtpd/parse.y
@@ -107,7 +107,7 @@ struct dispatcher *dispatcher;
struct rule *rule;
struct processor *processor;
struct filter_config *filter_config;
-/*static uint64_t last_dynproc_id = 1;*/
+static uint64_t last_dynproc_id = 1;
enum listen_options {
LO_FAMILY = 0x000001,
@@ -1333,7 +1333,6 @@ filterel
;
filter:
-/*
FILTER STRING PROC STRING {
if (dict_get(conf->sc_filters_dict, $2)) {
yyerror("filter already exists with that name: %s", $2);
@@ -1383,7 +1382,6 @@ FILTER STRING PROC_EXEC STRING {
filter_config = NULL;
}
|
-*/
FILTER STRING BUILTIN {
if (dict_get(conf->sc_filters_dict, $2)) {
yyerror("filter already exists with that name: %s", $2);