summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorGilles Chehade <gilles@cvs.openbsd.org>2018-03-14 22:22:31 +0000
committerGilles Chehade <gilles@cvs.openbsd.org>2018-03-14 22:22:31 +0000
commit1632b1b67715f412ffb5b720052880a84c3a1cd2 (patch)
treef51ea199e5335c1a6a68d68eecba0de6b1d08f74 /usr.sbin/smtpd
parent10113f0923faf71b661e39d88d0e982552598b01 (diff)
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@
Diffstat (limited to 'usr.sbin/smtpd')
-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