summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorSunil Nimmagadda <sunil@cvs.openbsd.org>2017-11-27 08:36:00 +0000
committerSunil Nimmagadda <sunil@cvs.openbsd.org>2017-11-27 08:36:00 +0000
commit2034306b73665cb1fe00e00d50b8f213caf49506 (patch)
tree5616c67d7bc83ff952ea0dccbfef719877a392db /usr.sbin/smtpd
parentd0eb47a2f6a6ea75161637f9dfd8bd93ec5d2bad (diff)
Show correct command execution status by checking against update
operation return value. Issue reported by 'Zelest' (Jesper Wallin). Suggestions and ok eric@ gilles@.
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/control.c4
-rw-r--r--usr.sbin/smtpd/lka.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index b30d53cdb31..b1123e6428b 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.119 2017/11/23 07:23:36 eric Exp $ */
+/* $OpenBSD: control.c,v 1.120 2017/11/27 08:35:59 sunil Exp $ */
/*
* Copyright (c) 2012 Gilles Chehade <gilles@poolp.org>
@@ -731,8 +731,8 @@ control_dispatch_ext(struct mproc *p, struct imsg *imsg)
if (len >= LINE_MAX)
goto invalid;
+ imsg->hdr.peerid = c->id;
m_forward(p_lka, imsg);
- m_compose(p, IMSG_CTL_OK, 0, 0, -1, NULL, 0);
return;
case IMSG_CTL_DISCOVER_EVPID:
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index e09be22788a..b73bd0131e6 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.200 2017/11/21 12:20:34 eric Exp $ */
+/* $OpenBSD: lka.c,v 1.201 2017/11/27 08:35:59 sunil Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -345,13 +345,17 @@ lka_imsg(struct mproc *p, struct imsg *imsg)
return;
case IMSG_CTL_UPDATE_TABLE:
+ ret = 0;
table = table_find(imsg->data, NULL);
if (table == NULL) {
log_warnx("warn: Lookup table not found: "
"\"%s\"", (char *)imsg->data);
- return;
- }
- table_update(table);
+ } else
+ ret = table_update(table);
+
+ m_compose(p_control,
+ (ret == 1) ? IMSG_CTL_OK : IMSG_CTL_FAIL,
+ imsg->hdr.peerid, 0, -1, NULL, 0);
return;
}