diff options
author | Eric Faurot <eric@cvs.openbsd.org> | 2012-11-12 14:58:54 +0000 |
---|---|---|
committer | Eric Faurot <eric@cvs.openbsd.org> | 2012-11-12 14:58:54 +0000 |
commit | b978afa593739cd00f56cc9f5737d18e8575bc8b (patch) | |
tree | 5c19c4f60f92f0ddd3977d36cea0a163bdb6e457 /usr.sbin/smtpd/lka_session.c | |
parent | 98b597918008f218253c1c75aca5d02f8cccae79 (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/lka_session.c')
-rw-r--r-- | usr.sbin/smtpd/lka_session.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c index 754aba5c9b6..9885c549625 100644 --- a/usr.sbin/smtpd/lka_session.c +++ b/usr.sbin/smtpd/lka_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lka_session.c,v 1.48 2012/10/16 11:10:38 eric Exp $ */ +/* $OpenBSD: lka_session.c,v 1.49 2012/11/12 14:58:53 eric Exp $ */ /* * Copyright (c) 2011 Gilles Chehade <gilles@openbsd.org> @@ -113,12 +113,12 @@ lka_session_forward_reply(struct forward_req *fwreq, int fd) if (fd == -1 && fwreq->status) { /* no .forward, just deliver to local user */ - log_debug("lka: no .forward for user %s, just deliver", + log_debug("debug: lka: no .forward for user %s, just deliver", fwreq->as_user); lka_submit(lks, rule, xn); } else if (fd == -1) { - log_debug("lka: opening .forward failed for user %s", + log_debug("debug: lka: opening .forward failed for user %s", fwreq->as_user); lks->ss.code = 530; lks->flags |= F_ERROR; @@ -159,7 +159,7 @@ lka_resume(struct lka_session *lks) /* delivery list is empty, reject */ if (TAILQ_FIRST(&lks->deliverylist) == NULL) { - log_info("lka_done: expansion led to empty delivery list"); + log_debug("debug: lka_done: expansion led to empty delivery list"); lks->flags |= F_ERROR; } error: @@ -200,7 +200,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) int r; if (xn->depth >= EXPAND_DEPTH) { - log_debug("lka_expand: node too deep."); + log_debug("debug: lka_expand: node too deep."); lks->flags |= F_ERROR; lks->ss.code = 530; return; @@ -213,7 +213,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) break; case EXPAND_ADDRESS: - log_debug("lka_expand: expanding address: %s@%s [depth=%d]", + log_debug("debug: lka_expand: expanding address: %s@%s [depth=%d]", xn->u.mailaddr.user, xn->u.mailaddr.domain, xn->depth); /* Pass the node through the ruleset */ @@ -246,7 +246,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) else if (r == 0) { lks->flags |= F_ERROR; lks->ss.code = 530; - log_debug("lka_expand: no aliases for virtual"); + log_debug("debug: lka_expand: no aliases for virtual"); } } else { @@ -261,10 +261,10 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) break; case EXPAND_USERNAME: - log_debug("lka_expand: expanding username: %s [depth=%d]", xn->u.user, xn->depth); + log_debug("debug: lka_expand: expanding username: %s [depth=%d]", xn->u.user, xn->depth); if (xn->sameuser) { - log_debug("lka_expand: same user, submitting"); + log_debug("debug: lka_expand: same user, submitting"); lka_submit(lks, rule, xn); break; } @@ -276,7 +276,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) if (rule->r_amap) { r = aliases_get(rule->r_amap, &lks->expand, xn->u.user); if (r == -1) { - log_debug("lka_expand: error in alias lookup"); + log_debug("debug: lka_expand: error in alias lookup"); lks->flags |= F_ERROR; lks->ss.code = 451; } @@ -286,7 +286,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) /* a username should not exceed the size of a system user */ if (strlen(xn->u.user) >= sizeof fwreq.as_user) { - log_debug("lka_expand: user-part too long to be a system user"); + log_debug("debug: lka_expand: user-part too long to be a system user"); lks->flags |= F_ERROR; lks->ss.code = 530; break; @@ -294,7 +294,7 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) pw = getpwnam(xn->u.user); if (pw == NULL) { - log_debug("lka_expand: user-part does not match system user"); + log_debug("debug: lka_expand: user-part does not match system user"); lks->flags |= F_ERROR; lks->ss.code = 530; break; @@ -311,12 +311,12 @@ lka_expand(struct lka_session *lks, struct rule *rule, struct expandnode *xn) break; case EXPAND_FILENAME: - log_debug("lka_expand: expanding filename: %s [depth=%d]", xn->u.buffer, xn->depth); + log_debug("debug: lka_expand: expanding filename: %s [depth=%d]", xn->u.buffer, xn->depth); lka_submit(lks, rule, xn); break; case EXPAND_FILTER: - log_debug("lka_expand: expanding filter: %s [depth=%d]", xn->u.buffer, xn->depth); + log_debug("debug: lka_expand: expanding filter: %s [depth=%d]", xn->u.buffer, xn->depth); lka_submit(lks, rule, xn); break; } @@ -328,7 +328,7 @@ lka_find_ancestor(struct expandnode *xn, enum expand_type type) while(xn && (xn->type != type)) xn = xn->parent; if (xn == NULL) { - log_warnx("lka_find_ancestor: no ancestors of type %i", type); + log_warnx("warn: lka_find_ancestor: no ancestors of type %i", type); fatalx(NULL); } return (xn); @@ -407,7 +407,7 @@ lka_submit(struct lka_session *lks, struct rule *rule, struct expandnode *xn) sizeof(ep->agent.mda.buffer), ep)) { lks->flags |= F_ERROR; lks->ss.code = 451; - log_warnx("format string result too long while " + log_warnx("warn: format string result too long while " " expanding for user %s", ep->agent.mda.user); free(ep); return; |