summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd
diff options
context:
space:
mode:
authorCharles Longeau <chl@cvs.openbsd.org>2010-01-03 14:37:38 +0000
committerCharles Longeau <chl@cvs.openbsd.org>2010-01-03 14:37:38 +0000
commit49a2ec610563c287ce3aee467f1057ea37d8e1ec (patch)
treeb2096f71417364dc7a5cb8bdfc55bf7d8af40249 /usr.sbin/smtpd
parentd86ff53c2f6693c7445399488d519aa1120d2ee9 (diff)
Implement "log verbose" and "log brief" to enable or disable verbose debug
logging on runtime. Based on claudio@'s work on ripd, ospfd, ospf6d, dvmrpd, ldpd, bgpd. With help/ideas/testing from gilles@ jacekm@ todd@ ok jacekm@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r--usr.sbin/smtpd/control.c18
-rw-r--r--usr.sbin/smtpd/lka.c11
-rw-r--r--usr.sbin/smtpd/log.c12
-rw-r--r--usr.sbin/smtpd/mda.c11
-rw-r--r--usr.sbin/smtpd/mfa.c11
-rw-r--r--usr.sbin/smtpd/mta.c11
-rw-r--r--usr.sbin/smtpd/parser.c10
-rw-r--r--usr.sbin/smtpd/parser.h4
-rw-r--r--usr.sbin/smtpd/queue.c57
-rw-r--r--usr.sbin/smtpd/runner.c11
-rw-r--r--usr.sbin/smtpd/smtp.c11
-rw-r--r--usr.sbin/smtpd/smtpctl.88
-rw-r--r--usr.sbin/smtpd/smtpctl.c15
-rw-r--r--usr.sbin/smtpd/smtpd.c79
-rw-r--r--usr.sbin/smtpd/smtpd.h4
15 files changed, 254 insertions, 19 deletions
diff --git a/usr.sbin/smtpd/control.c b/usr.sbin/smtpd/control.c
index 254908b9d56..dae67ae6aae 100644
--- a/usr.sbin/smtpd/control.c
+++ b/usr.sbin/smtpd/control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: control.c,v 1.44 2009/12/23 17:16:03 jacekm Exp $ */
+/* $OpenBSD: control.c,v 1.45 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -399,6 +399,22 @@ control_dispatch_ext(int fd, short event, void *arg)
env->sc_flags |= SMTPD_EXITING;
imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0);
break;
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ if (euid)
+ goto badcred;
+
+ if (IMSG_DATA_SIZE(&imsg) != sizeof(verbose))
+ goto badcred;
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ imsg_compose_event(env->sc_ievs[PROC_PARENT], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(&c->iev, IMSG_CTL_OK, 0, 0, -1, NULL, 0);
+ break;
+ }
case IMSG_MDA_PAUSE:
if (euid)
goto badcred;
diff --git a/usr.sbin/smtpd/lka.c b/usr.sbin/smtpd/lka.c
index 3ea8d76a049..a50ae6c829b 100644
--- a/usr.sbin/smtpd/lka.c
+++ b/usr.sbin/smtpd/lka.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka.c,v 1.97 2009/12/15 00:23:38 jacekm Exp $ */
+/* $OpenBSD: lka.c,v 1.98 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -258,6 +258,15 @@ lka_dispatch_parent(int sig, short event, void *p)
lka_expand_pickup(env, lkasession);
break;
}
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("lka_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/log.c b/usr.sbin/smtpd/log.c
index ffdcb574ad7..5458c36907c 100644
--- a/usr.sbin/smtpd/log.c
+++ b/usr.sbin/smtpd/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 2008/12/04 17:24:13 cloder Exp $ */
+/* $OpenBSD: log.c,v 1.4 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -36,6 +36,7 @@
#include "smtpd.h"
int debug;
+int verbose;
void vlog(int, const char *, va_list);
void logit(int, const char *, ...)
@@ -48,6 +49,7 @@ log_init(int n_debug)
extern char *__progname;
debug = n_debug;
+ verbose = n_debug;
if (!debug)
openlog(__progname, LOG_PID | LOG_NDELAY, LOG_MAIL);
@@ -56,6 +58,12 @@ log_init(int n_debug)
}
void
+log_verbose(int v)
+{
+ verbose = v;
+}
+
+void
logit(int pri, const char *fmt, ...)
{
va_list ap;
@@ -134,7 +142,7 @@ log_debug(const char *emsg, ...)
{
va_list ap;
- if (debug > 1) {
+ if (verbose) {
va_start(ap, emsg);
vlog(LOG_DEBUG, emsg, ap);
va_end(ap);
diff --git a/usr.sbin/smtpd/mda.c b/usr.sbin/smtpd/mda.c
index 6f5c8e43e95..40d0a9b8179 100644
--- a/usr.sbin/smtpd/mda.c
+++ b/usr.sbin/smtpd/mda.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mda.c,v 1.34 2009/12/14 16:44:14 jacekm Exp $ */
+/* $OpenBSD: mda.c,v 1.35 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -166,6 +166,15 @@ mda_dispatch_parent(int sig, short event, void *p)
break;
}
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("mda_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/mfa.c b/usr.sbin/smtpd/mfa.c
index 549f597b6a8..c9001efe249 100644
--- a/usr.sbin/smtpd/mfa.c
+++ b/usr.sbin/smtpd/mfa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfa.c,v 1.42 2009/10/18 20:41:21 gilles Exp $ */
+/* $OpenBSD: mfa.c,v 1.43 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -99,6 +99,15 @@ mfa_dispatch_parent(int sig, short event, void *p)
break;
switch (imsg.hdr.type) {
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("mfa_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c
index dc64b81ccab..f1c10568ff3 100644
--- a/usr.sbin/smtpd/mta.c
+++ b/usr.sbin/smtpd/mta.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mta.c,v 1.83 2009/12/23 17:16:03 jacekm Exp $ */
+/* $OpenBSD: mta.c,v 1.84 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -146,6 +146,15 @@ mta_dispatch_parent(int sig, short event, void *p)
break;
env->sc_flags &= ~SMTPD_CONFIGURING;
break;
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("mta_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/parser.c b/usr.sbin/smtpd/parser.c
index 8fe1a89a134..e76e63f0295 100644
--- a/usr.sbin/smtpd/parser.c
+++ b/usr.sbin/smtpd/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.9 2009/10/25 19:46:31 gilles Exp $ */
+/* $OpenBSD: parser.c,v 1.10 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -61,6 +61,7 @@ static const struct token t_show[];
static const struct token t_pause[];
static const struct token t_resume[];
static const struct token t_schedule[];
+static const struct token t_log[];
static const struct token t_main[] = {
{KEYWORD, "show", NONE, t_show},
@@ -70,6 +71,7 @@ static const struct token t_main[] = {
{KEYWORD, "resume", NONE, t_resume},
{KEYWORD, "stop", SHUTDOWN, NULL},
{KEYWORD, "schedule", SCHEDULE, t_schedule},
+ {KEYWORD, "log", NONE, t_log},
{ENDTOKEN, "", NONE, NULL}
};
@@ -99,6 +101,12 @@ static const struct token t_schedule[] = {
{ENDTOKEN, "", NONE, NULL}
};
+static const struct token t_log[] = {
+ {KEYWORD, "verbose", LOG_VERBOSE, NULL},
+ {KEYWORD, "brief", LOG_BRIEF, NULL},
+ {ENDTOKEN, "", NONE, NULL}
+};
+
static struct parse_result res;
struct parse_result *
diff --git a/usr.sbin/smtpd/parser.h b/usr.sbin/smtpd/parser.h
index e4d9d458d9d..39f0a7b74ad 100644
--- a/usr.sbin/smtpd/parser.h
+++ b/usr.sbin/smtpd/parser.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.h,v 1.8 2009/08/08 00:02:22 gilles Exp $ */
+/* $OpenBSD: parser.h,v 1.9 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -22,6 +22,8 @@ enum actions {
RELOAD,
MONITOR,
SCHEDULE,
+ LOG_VERBOSE,
+ LOG_BRIEF,
SHOW_QUEUE,
SHOW_RUNQUEUE,
SHOW_STATS,
diff --git a/usr.sbin/smtpd/queue.c b/usr.sbin/smtpd/queue.c
index a1e190db48c..a0f4be9b27d 100644
--- a/usr.sbin/smtpd/queue.c
+++ b/usr.sbin/smtpd/queue.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: queue.c,v 1.76 2009/12/14 19:56:55 jacekm Exp $ */
+/* $OpenBSD: queue.c,v 1.77 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -39,6 +39,7 @@
__dead void queue_shutdown(void);
void queue_sig_handler(int, short, void *);
+void queue_dispatch_parent(int, short, void *);
void queue_dispatch_control(int, short, void *);
void queue_dispatch_smtp(int, short, void *);
void queue_dispatch_mda(int, short, void *);
@@ -73,6 +74,59 @@ queue_sig_handler(int sig, short event, void *p)
}
void
+queue_dispatch_parent(int sig, short event, void *p)
+{
+ struct smtpd *env = p;
+ struct imsgev *iev;
+ struct imsgbuf *ibuf;
+ struct imsg imsg;
+ ssize_t n;
+
+ iev = env->sc_ievs[PROC_PARENT];
+ ibuf = &iev->ibuf;
+
+ if (event & EV_READ) {
+ if ((n = imsg_read(ibuf)) == -1)
+ fatal("imsg_read_error");
+ if (n == 0) {
+ /* this pipe is dead, so remove the event handler */
+ event_del(&iev->ev);
+ event_loopexit(NULL);
+ return;
+ }
+ }
+
+ if (event & EV_WRITE) {
+ if (msgbuf_write(&ibuf->w) == -1)
+ fatal("msgbuf_write");
+ }
+
+ for (;;) {
+ if ((n = imsg_get(ibuf, &imsg)) == -1)
+ fatal("queue_dispatch_parent: imsg_get error");
+ if (n == 0)
+ break;
+
+ switch (imsg.hdr.type) {
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
+ default:
+ log_warnx("got imsg %d", imsg.hdr.type);
+ fatalx("queue_dispatch_parent: unexpected imsg");
+ }
+ imsg_free(&imsg);
+ }
+ imsg_event_add(iev);
+}
+
+void
queue_dispatch_control(int sig, short event, void *p)
{
struct smtpd *env = p;
@@ -530,6 +584,7 @@ queue(struct smtpd *env)
struct event ev_sigterm;
struct peer peers[] = {
+ { PROC_PARENT, queue_dispatch_parent },
{ PROC_CONTROL, queue_dispatch_control },
{ PROC_SMTP, queue_dispatch_smtp },
{ PROC_MDA, queue_dispatch_mda },
diff --git a/usr.sbin/smtpd/runner.c b/usr.sbin/smtpd/runner.c
index 6accfd5f145..4f541e5978e 100644
--- a/usr.sbin/smtpd/runner.c
+++ b/usr.sbin/smtpd/runner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: runner.c,v 1.76 2009/12/14 19:56:55 jacekm Exp $ */
+/* $OpenBSD: runner.c,v 1.77 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -134,6 +134,15 @@ runner_dispatch_parent(int sig, short event, void *p)
case IMSG_PARENT_ENQUEUE_OFFLINE:
runner_process_offline(env);
break;
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("runner_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 4df8c98bdf5..9d779887f53 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.66 2009/12/14 19:49:22 jacekm Exp $ */
+/* $OpenBSD: smtp.c,v 1.67 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -208,6 +208,15 @@ smtp_dispatch_parent(int sig, short event, void *p)
session_pickup(s, NULL);
break;
}
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+ break;
+ }
default:
log_warnx("smtp_dispatch_parent: got imsg %d",
imsg.hdr.type);
diff --git a/usr.sbin/smtpd/smtpctl.8 b/usr.sbin/smtpd/smtpctl.8
index 9a862d6f2f4..2e726493ec9 100644
--- a/usr.sbin/smtpd/smtpctl.8
+++ b/usr.sbin/smtpd/smtpctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: smtpctl.8,v 1.10 2009/10/22 15:02:12 sobrado Exp $
+.\" $OpenBSD: smtpctl.8,v 1.11 2010/01/03 14:37:37 chl Exp $
.\"
.\" Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: October 22 2009 $
+.Dd $Mdocdate: January 3 2010 $
.Dt SMTPCTL 8
.Os
.Sh NAME
@@ -32,6 +32,10 @@ program controls
.Pp
The following commands are available:
.Bl -tag -width Ds
+.It Cm log brief
+Disable verbose debug logging.
+.It Cm log verbose
+Enable verbose debug logging.
.It Cm pause incoming
Temporarily stop accepting incoming sessions.
.It Cm pause local
diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c
index 99137c99de6..93d32fd13a5 100644
--- a/usr.sbin/smtpd/smtpctl.c
+++ b/usr.sbin/smtpd/smtpctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpctl.c,v 1.44 2009/12/14 18:21:53 jacekm Exp $ */
+/* $OpenBSD: smtpctl.c,v 1.45 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -92,7 +92,7 @@ main(int argc, char *argv[])
struct imsg imsg;
int ctl_sock;
int done = 0;
- int n;
+ int n, verbose = 0;
/* parse options */
if (strcmp(__progname, "sendmail") == 0 || strcmp(__progname, "send-mail") == 0)
@@ -192,6 +192,15 @@ connected:
case MONITOR:
/* XXX */
break;
+ case LOG_VERBOSE:
+ verbose = 1;
+ /* FALLTHROUGH */
+ case LOG_BRIEF:
+ imsg_compose(ibuf, IMSG_CTL_VERBOSE, 0, 0, -1, &verbose,
+ sizeof(verbose));
+ printf("logging request sent.\n");
+ done = 1;
+ break;
default:
err(1, "unknown request (%d)", res->action);
}
@@ -221,6 +230,8 @@ connected:
case RESUME_MDA:
case RESUME_MTA:
case RESUME_SMTP:
+ case LOG_VERBOSE:
+ case LOG_BRIEF:
done = show_command_output(&imsg);
break;
case SHOW_STATS:
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 57820ce4d21..670feb0c199 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.c,v 1.93 2009/12/24 14:19:46 gilles Exp $ */
+/* $OpenBSD: smtpd.c,v 1.94 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -58,6 +58,7 @@ void parent_dispatch_mfa(int, short, void *);
void parent_dispatch_mta(int, short, void *);
void parent_dispatch_smtp(int, short, void *);
void parent_dispatch_runner(int, short, void *);
+void parent_dispatch_queue(int, short, void *);
void parent_dispatch_control(int, short, void *);
void parent_sig_handler(int, short, void *);
int parent_open_message_file(struct batch *);
@@ -646,6 +647,51 @@ parent_dispatch_smtp(int fd, short event, void *p)
}
void
+parent_dispatch_queue(int sig, short event, void *p)
+{
+ struct smtpd *env = p;
+ struct imsgev *iev;
+ struct imsgbuf *ibuf;
+ struct imsg imsg;
+ ssize_t n;
+
+ iev = env->sc_ievs[PROC_QUEUE];
+ ibuf = &iev->ibuf;
+
+ if (event & EV_READ) {
+ if ((n = imsg_read(ibuf)) == -1)
+ fatal("imsg_read_error");
+ if (n == 0) {
+ /* this pipe is dead, so remove the event handler */
+ event_del(&iev->ev);
+ event_loopexit(NULL);
+ return;
+ }
+ }
+
+ if (event & EV_WRITE) {
+ if (msgbuf_write(&ibuf->w) == -1)
+ fatal("msgbuf_write");
+ }
+
+ for (;;) {
+ if ((n = imsg_get(ibuf, &imsg)) == -1)
+ fatal("parent_dispatch_queue: imsg_get error");
+ if (n == 0)
+ break;
+
+ switch (imsg.hdr.type) {
+ default:
+ log_warnx("parent_dispatch_queue: got imsg %d",
+ imsg.hdr.type);
+ fatalx("parent_dispatch_queue: unexpected imsg");
+ }
+ imsg_free(&imsg);
+ }
+ imsg_event_add(iev);
+}
+
+void
parent_dispatch_runner(int sig, short event, void *p)
{
struct smtpd *env = p;
@@ -755,6 +801,31 @@ parent_dispatch_control(int sig, short event, void *p)
imsg_compose_event(iev, IMSG_CONF_RELOAD, 0, 0, -1, r, sizeof(*r));
break;
}
+ case IMSG_CTL_VERBOSE: {
+ int verbose;
+
+ IMSG_SIZE_CHECK(&verbose);
+
+ memcpy(&verbose, imsg.data, sizeof(verbose));
+ log_verbose(verbose);
+
+ /* forward to other processes */
+ imsg_compose_event(env->sc_ievs[PROC_LKA], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_MDA], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_MFA], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_MTA], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_QUEUE], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_RUNNER], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ imsg_compose_event(env->sc_ievs[PROC_SMTP], IMSG_CTL_VERBOSE,
+ 0, 0, -1, &verbose, sizeof(verbose));
+ break;
+ }
default:
log_warnx("parent_dispatch_control: got imsg %d",
imsg.hdr.type);
@@ -857,7 +928,7 @@ int
main(int argc, char *argv[])
{
int c;
- int debug;
+ int debug, verbose;
int opts;
const char *conffile = CONF_FILE;
struct smtpd env;
@@ -873,11 +944,13 @@ main(int argc, char *argv[])
{ PROC_MFA, parent_dispatch_mfa },
{ PROC_MTA, parent_dispatch_mta },
{ PROC_SMTP, parent_dispatch_smtp },
+ { PROC_QUEUE, parent_dispatch_queue },
{ PROC_RUNNER, parent_dispatch_runner }
};
opts = 0;
debug = 0;
+ verbose = 0;
log_init(1);
@@ -899,6 +972,7 @@ main(int argc, char *argv[])
conffile = optarg;
break;
case 'v':
+ verbose = 1;
opts |= SMTPD_OPT_VERBOSE;
break;
default:
@@ -932,6 +1006,7 @@ main(int argc, char *argv[])
errx(1, "invalid directory permissions");
log_init(debug);
+ log_verbose(verbose);
if (!debug)
if (daemon(0, 0) == -1)
diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h
index 1b01880714a..8b1fe8bdba1 100644
--- a/usr.sbin/smtpd/smtpd.h
+++ b/usr.sbin/smtpd/smtpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtpd.h,v 1.166 2009/12/24 14:19:46 gilles Exp $ */
+/* $OpenBSD: smtpd.h,v 1.167 2010/01/03 14:37:37 chl Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -119,6 +119,7 @@ enum imsg_type {
IMSG_CTL_OK, /* answer to smtpctl requests */
IMSG_CTL_FAIL,
IMSG_CTL_SHUTDOWN,
+ IMSG_CTL_VERBOSE,
IMSG_CONF_START,
IMSG_CONF_SSL,
IMSG_CONF_SSL_CERT,
@@ -827,6 +828,7 @@ int bounce_session_switch(struct smtpd *, FILE *, enum session_state *, char *,
/* log.c */
void log_init(int);
+void log_verbose(int);
void log_warn(const char *, ...)
__attribute__ ((format (printf, 1, 2)));
void log_warnx(const char *, ...)