summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2019-12-09 20:36:23 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2019-12-09 20:36:23 +0000
commit550af6b45be6cd935a4cfe559d319da6746537f5 (patch)
treecf788964d9aec4943c298b56b0e90aef1121266f
parente84ec206ce427d7d6b094f8cfc2fa02830396dfc (diff)
swap two fields in the filter response protocol to match order of fields in
the query protocol. this difference was overlooked and is error-prone for a filter developer. bump filter protocol. when you update your smtpd, if you use filters, they'll need to be updated. spotted by Chris Ross <cross+openbsd@distal.com>
-rw-r--r--usr.sbin/smtpd/lka_filter.c20
-rw-r--r--usr.sbin/smtpd/lka_report.c4
2 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/smtpd/lka_filter.c b/usr.sbin/smtpd/lka_filter.c
index 695ce4c3358..ce7a444548d 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.50 2019/09/11 20:06:26 gilles Exp $ */
+/* $OpenBSD: lka_filter.c,v 1.51 2019/12/09 20:36:22 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -35,7 +35,7 @@
#include "smtpd.h"
#include "log.h"
-#define PROTOCOL_VERSION "0.4"
+#define PROTOCOL_VERSION "0.5"
struct filter;
struct filter_session;
@@ -441,22 +441,22 @@ lka_filter_process_response(const char *name, const char *line)
fatalx("Missing reqid: %s", line);
ep[0] = '\0';
- token = strtoull(qid, &ep, 16);
+ reqid = strtoull(qid, &ep, 16);
if (qid[0] == '\0' || *ep != '\0')
- fatalx("Invalid token: %s", line);
- if (errno == ERANGE && token == ULLONG_MAX)
- fatal("Invalid token: %s", line);
+ fatalx("Invalid reqid: %s", line);
+ if (errno == ERANGE && reqid == ULLONG_MAX)
+ fatal("Invalid reqid: %s", line);
qid = ep+1;
if ((ep = strchr(qid, '|')) == NULL)
fatal("Missing directive: %s", line);
ep[0] = '\0';
- reqid = strtoull(qid, &ep, 16);
+ token = strtoull(qid, &ep, 16);
if (qid[0] == '\0' || *ep != '\0')
- fatalx("Invalid reqid: %s", line);
- if (errno == ERANGE && reqid == ULLONG_MAX)
- fatal("Invalid reqid: %s", line);
+ fatalx("Invalid token: %s", line);
+ if (errno == ERANGE && token == ULLONG_MAX)
+ fatal("Invalid token: %s", line);
response = ep+1;
diff --git a/usr.sbin/smtpd/lka_report.c b/usr.sbin/smtpd/lka_report.c
index 95562e84371..53357b7aa85 100644
--- a/usr.sbin/smtpd/lka_report.c
+++ b/usr.sbin/smtpd/lka_report.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_report.c,v 1.34 2019/10/03 05:42:57 gilles Exp $ */
+/* $OpenBSD: lka_report.c,v 1.35 2019/12/09 20:36:22 gilles Exp $ */
/*
* Copyright (c) 2018 Gilles Chehade <gilles@poolp.org>
@@ -35,7 +35,7 @@
#include "smtpd.h"
#include "log.h"
-#define PROTOCOL_VERSION "0.4"
+#define PROTOCOL_VERSION "0.5"
struct reporter_proc {
TAILQ_ENTRY(reporter_proc) entries;