summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtp.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2012-11-12 14:58:54 +0000
committerEric Faurot <eric@cvs.openbsd.org>2012-11-12 14:58:54 +0000
commitb978afa593739cd00f56cc9f5737d18e8575bc8b (patch)
tree5c19c4f60f92f0ddd3977d36cea0a163bdb6e457 /usr.sbin/smtpd/smtp.c
parent98b597918008f218253c1c75aca5d02f8cccae79 (diff)
Cleanups and improvements:
* Log more events (especially client session) and use a better scheme for that: each messages is prefixed with a token to easily identify its class: - info/warn/debug: general server messages - smtp-in: smtp client connections - relay: status update for relayed messages - delivery: status update for local deliveries * Implement "smtpctl monitor" to display updates of selected internal counters. * When reloading the on-disk queue at startup do not commit a message if no envelope was submitted for that message. * Remove unused stuff in the config parser. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtp.c')
-rw-r--r--usr.sbin/smtpd/smtp.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.sbin/smtpd/smtp.c b/usr.sbin/smtpd/smtp.c
index 461c5d89343..73067afcd74 100644
--- a/usr.sbin/smtpd/smtp.c
+++ b/usr.sbin/smtpd/smtp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: smtp.c,v 1.120 2012/10/07 15:46:38 chl Exp $ */
+/* $OpenBSD: smtp.c,v 1.121 2012/11/12 14:58:53 eric Exp $ */
/*
* Copyright (c) 2008 Gilles Chehade <gilles@openbsd.org>
@@ -259,13 +259,13 @@ smtp_imsg(struct imsgev *iev, struct imsg *imsg)
return;
case IMSG_SMTP_PAUSE:
- log_debug("smtp: pausing listening sockets");
+ log_debug("debug: smtp: pausing listening sockets");
smtp_pause();
env->sc_flags |= SMTPD_SMTP_PAUSED;
return;
case IMSG_SMTP_RESUME:
- log_debug("smtp: resuming listening sockets");
+ log_debug("debug: smtp: resuming listening sockets");
env->sc_flags &= ~SMTPD_SMTP_PAUSED;
smtp_resume();
return;
@@ -291,7 +291,7 @@ smtp_sig_handler(int sig, short event, void *p)
static void
smtp_shutdown(void)
{
- log_info("smtp server exiting");
+ log_info("info: smtp server exiting");
_exit(0);
}
@@ -366,7 +366,7 @@ smtp_setup_events(void)
struct listener *l;
TAILQ_FOREACH(l, env->sc_listeners, entry) {
- log_debug("smtp: listen on %s port %d flags 0x%01x"
+ log_debug("debug: smtp: listen on %s port %d flags 0x%01x"
" cert \"%s\"", ss_to_text(&l->ss), ntohs(l->port),
l->flags, l->ssl_cert_name);
@@ -381,7 +381,7 @@ smtp_setup_events(void)
ssl_setup(l);
}
- log_debug("smtp: will accept at most %d clients",
+ log_debug("debug: smtp: will accept at most %d clients",
(getdtablesize() - getdtablecount())/2 - SMTP_FD_RESERVE);
}
@@ -463,14 +463,14 @@ smtp_accept(int fd, short event, void *p)
socklen_t len;
if ((s = smtp_new(l)) == NULL) {
- log_warnx("smtp: client limit hit, disabling incoming connections");
+ log_warnx("warn: smtp: client limit hit, disabling incoming connections");
goto pause;
}
len = sizeof(s->s_ss);
if ((s->s_io.sock = accept(fd, (struct sockaddr *)&s->s_ss, &len)) == -1) {
if (errno == ENFILE || errno == EMFILE) {
- log_warnx("smtp: fd exhaustion, disabling incoming connections");
+ log_warnx("warn: smtp: fd exhaustion, disabling incoming connections");
goto pause;
}
if (errno == EINTR || errno == ECONNABORTED)
@@ -495,7 +495,7 @@ smtp_new(struct listener *l)
{
struct session *s;
- log_debug("smtp: new client on listener: %p", l);
+ log_debug("debug: smtp: new client on listener: %p", l);
if (env->sc_flags & SMTPD_SMTP_PAUSED)
fatalx("smtp_new: unexpected client");
@@ -537,7 +537,7 @@ smtp_destroy(struct session *session)
return;
if (env->sc_flags & SMTPD_SMTP_DISABLED) {
- log_warnx("smtp: fd exaustion over, re-enabling incoming connections");
+ log_warnx("warn: smtp: fd exaustion over, re-enabling incoming connections");
env->sc_flags &= ~SMTPD_SMTP_DISABLED;
smtp_resume();
}