summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgilles <gilles@openbsd.org>2018-03-14 22:22:30 +0000
committergilles <gilles@openbsd.org>2018-03-14 22:22:30 +0000
commit5b9e028daa628ae5d586935ccc1683fa9b6e629f (patch)
tree1dd9100cf6ffa5b1617989a97460f874f6783fa2
parentMessage-Id header is not added if sent over submission port because the (diff)
downloadwireguard-openbsd-5b9e028daa628ae5d586935ccc1683fa9b6e629f.tar.xz
wireguard-openbsd-5b9e028daa628ae5d586935ccc1683fa9b6e629f.zip
newaliases is so 70s, very tied to the 'db' table backend (which has not
been the default for a long time now) but users still assume this is the way to update aliases within the MTA. when smtpctl is invoked as newaliases, have it notify the daemon that it has had the aliases table updated, no matter what backend it uses, as it will at worst be a noop and at best do what user expected. ok eric@
-rw-r--r--usr.sbin/smtpd/smtpctl.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 76949609c1f..fff07abb457 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.157 2018/01/30 12:44:55 eric Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.158 2018/03/14 22:22:30 gilles Exp $ */
/*
* Copyright (c) 2013 Eric Faurot <eric@openbsd.org>
@@ -1130,7 +1130,7 @@ sendmail_compat(int argc, char **argv)
{
FILE *offlinefp = NULL;
gid_t gid;
- int i;
+ int i, r;
if (strcmp(__progname, "sendmail") == 0 ||
strcmp(__progname, "send-mail") == 0) {
@@ -1158,8 +1158,18 @@ sendmail_compat(int argc, char **argv)
exit(enqueue(argc, argv, offlinefp));
} else if (strcmp(__progname, "makemap") == 0)
exit(makemap(P_MAKEMAP, argc, argv));
- else if (strcmp(__progname, "newaliases") == 0)
- exit(makemap(P_NEWALIASES, argc, argv));
+ else if (strcmp(__progname, "newaliases") == 0) {
+ r = makemap(P_NEWALIASES, argc, argv);
+ /*
+ * if server is available, notify of table update.
+ * only makes sense for static tables AND if server is up.
+ */
+ if (srv_connect()) {
+ srv_send(IMSG_CTL_UPDATE_TABLE, "aliases", strlen("aliases") + 1);
+ srv_check_result(0);
+ }
+ exit(r);
+ }
}
static void