--- lmtp2nntp.c 2001/09/10 10:16:05 1.47
+++ lmtp2nntp.c 2001/09/10 12:49:48 1.48
@@ -275,11 +275,11 @@
/* library version check (run-time) */
if (l2_version.v_hex < L2_VERSION_HEX_REQ) {
- fprintf(stderr, "require at least OSSP L2 >= %s\n", L2_VERSION_STR_REQ);
+ fprintf(stderr, "require OSSP L2 >= %s, found %s\n", L2_VERSION_STR_REQ, L2_VERSION_STR);
exit(ERR_EXECUTION);
}
- if (str_version.v_hex < STR_VERSION_HEX_REQ + 1) {
- fprintf(stderr, "require at least OSSP Str >= %s\n", STR_VERSION_STR_REQ);
+ if (str_version.v_hex < STR_VERSION_HEX_REQ) {
+ fprintf(stderr, "require OSSP Str >= %s, found %s\n", STR_VERSION_STR_REQ, STR_VERSION_STR);
exit(ERR_EXECUTION);
}
@@ -594,7 +594,7 @@
exit(ERR_EXECUTION);
}
- if (l2_stream_log(ctx->l2, L2_LEVEL_INFO, "%P: startup, version %s", lmtp2nntp_version.v_gnu) != L2_OK) {
+ if (l2_stream_log(ctx->l2, L2_LEVEL_NOTICE, "%P: startup, version %s", lmtp2nntp_version.v_gnu) != L2_OK) {
fprintf(stderr, "%s:Error: logging failed to log startup message to stream\n", ctx->progname);
exit(ERR_EXECUTION);
}
@@ -639,7 +639,7 @@
/* graceful shutdown */
lmtp_gfs_quit(ctx);
lmtp_gfs_lhlo(ctx);
- log0(ctx, INFO, "%P: graceful shutdown, no more logging until exit");
+ log0(ctx, NOTICE, "%P: graceful shutdown shortly before exit - no more logging");
l2_stream_destroy(ctx->l2);
lmtp_destroy(lmtp);
if (ctx->option_logfile != NULL)
@@ -755,7 +755,7 @@
int i;
nntp_io_t nntp_io;
- log1(ctx, INFO, "lmtp_cb_lhlo < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing LHLO command < %s", req->msg);
nntp_io.ctx = ctx;
nntp_io.select = NULL;
@@ -766,7 +766,7 @@
* RFC1893 2. Status Codes 5.X.X Permanent Failure
* RFC1893 3.5 Network and Routing Status X.0.0 Other undefined Status
*/
- log0(ctx, TRACE, "checking for Duplicate LHLO");
+ log0(ctx, TRACE, "checking for duplicate LHLO");
if (ctx->session.lhlo_seen) {
res.statuscode = "503";
res.dsncode = "5.0.0";
@@ -778,7 +778,7 @@
* RFC1893 2. Status Codes 5.X.X Permanent Failure
* RFC1893 3.5 Network and Routing Status X.0.0 Other undefined Status
*/
- log0(ctx, TRACE, "checking lhlo_domain to match either RFC0821 or RFC1035 syntax");
+ log0(ctx, TRACE, "checking domain to match either RFC0821 or RFC1035 syntax");
if (! ( helo_rfc0821domain(req->msg, &ctx->session.lhlo_domain) > 0
|| helo_rfc1035domain(req->msg, &ctx->session.lhlo_domain) > 0)) {
res.statuscode = "501";
@@ -810,7 +810,7 @@
log2(ctx, DEBUG, "bind local socket to %s:%s", ctx->cpBindh, ctx->cpBindp);
if (bind(ctx->ns[i].s, ctx->saBind->sa_buf, ctx->saBind->sa_len) < 0) {
bOk = FALSE;
- log0(ctx, ERROR, "bind=%m");
+ log2(ctx, ERROR, "binding NNTP client to local address %s:%s failed, %m", ctx->cpBindh, ctx->cpBindp);
}
}
@@ -820,14 +820,16 @@
if (connect_nonb(ctx->ns[i].s, ctx->ns[i].sa->sa_buf, ctx->ns[i].sa->sa_len,
ctx->option_waittime) < 0) {
bOk = FALSE;
- log0(ctx, WARNING, "connect_nonb=%m");
+ log3(ctx, WARNING, "nonblocking connect to %s:%s with waittime=%d failed, %m",
+ ctx->ns[i].h, ctx->ns[i].p, ctx->option_waittime);
}
}
else {
log0(ctx, DEBUG, "connect");
if (connect(ctx->ns[i].s, ctx->ns[i].sa->sa_buf, ctx->ns[i].sa->sa_len) < 0) {
bOk = FALSE;
- log0(ctx, WARNING, "connect=%m");
+ log2(ctx, WARNING, "connect to %s:%s failed, %m",
+ ctx->ns[i].h, ctx->ns[i].p);
}
}
}
@@ -838,7 +840,7 @@
(ctx->option_logfile && (ctx->option_levelmask >= L2_LEVEL_TRACE)) ?
&nntp_io : NULL)) == NULL) {
bOk = FALSE;
- log0(ctx, ERROR, "nntp_create failed");
+ log0(ctx, ERROR, "creation of NNTP context failed");
}
}
@@ -851,7 +853,7 @@
log0(ctx, DEBUG, "nntp_init");
if ((rc = nntp_init(ctx->ns[i].nntp)) != NNTP_OK) {
bOk = FALSE;
- log2(ctx, ERROR, "nntp_init=(%m) %s", rc, nntp_error(rc));
+ log2(ctx, ERROR, "initialization of NNTP context failed, (%d) %s", rc, nntp_error(rc));
}
}
@@ -908,7 +910,7 @@
{
int i;
- log0(ctx, INFO, "lmtp_gfs_lhlo - graceful shutdown");
+ log0(ctx, TRACE, "LMTP service LHLO command - graceful shutdown");
for (i = 0; i < ctx->nsc; i++) {
if (ctx->ns[i].nntp != NULL)
@@ -1054,7 +1056,7 @@
lmtp_rc_t rc;
lmtp_res_t res;
- log1(ctx, INFO, "lmtp_cb_mail < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing MAIL command < %s", req->msg);
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 553 Requested action not taken: mailbox name not allowed
* RFC1893 2. Status Codes 5.X.X Permanent Failure
@@ -1170,7 +1172,7 @@
char *cp;
char *group;
- log1(ctx, INFO, "lmtp_cb_rcpt < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing RCPT command < %s", req->msg);
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 503 Bad sequence of commands
* RFC1893 2. Status Codes 5.X.X Permanent Failure
@@ -1281,7 +1283,7 @@
int bSuccess;
char *cp;
- log1(ctx, INFO, "lmtp_cb_data < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing DATA command < %s", req->msg);
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 503 Bad sequence of commands
* RFC1893 2. Status Codes 5.X.X Permanent Failure
@@ -1304,7 +1306,7 @@
res.statusmsg = "Enter mail, end with \".\" on a line by itself";
lmtp_response(lmtp, &res);
- log1(ctx, TRACE, "lmtp_readmsg, maximum size to accept = %d", ctx->option_maxmessagesize);
+ log1(ctx, TRACE, "read message with maximum size to accept = %d", ctx->option_maxmessagesize);
rc = lmtp_readmsg(lmtp, &ctx->msg->cpMsg, ctx->option_maxmessagesize);
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 552 Requested mail action aborted: exceeded storage allocation
@@ -1457,7 +1459,7 @@
}
log0(ctx, TRACE, "deliver message");
- bSuccess = NNTP_EOF; /* assume a hard error for the worst case */
+ bSuccess = NNTP_ERR_DELIVERY; /* assume a hard error for the worst case */
for (i = 0; i < ctx->nsc; i++) {
switch (ctx->option_deliverymode) {
case DELIVERYMODE_FAKE:
@@ -1481,6 +1483,17 @@
bSuccess = NNTP_DEFER;
}
+ str_format(errorstring, sizeof(errorstring), "%sdelivery of %s",
+ ((ctx->option_deliverymode == DELIVERYMODE_FAKE) ? "fake " :
+ (ctx->option_deliverymode == DELIVERYMODE_POST) ? "post " :
+ (ctx->option_deliverymode == DELIVERYMODE_FEED) ? "feed " : ""), ctx->msg->cpMsgid);
+ if (bSuccess == NNTP_OK)
+ log2(ctx, NOTICE, "%s %s", errorstring, "succeeded");
+ else if(bSuccess == NNTP_DEFER)
+ log2(ctx, WARNING, "%s %s", errorstring, "deferred");
+ else
+ log2(ctx, ERROR, "%s %s", errorstring, "failed");
+
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 250 Requested mail action okay, completed
* 451 Requested action aborted: local error in processing
* 554 Transaction failed
@@ -1554,7 +1567,7 @@
lmtp_res_t res;
lmtp_rc_t rc = LMTP_OK;
- log1(ctx, INFO, "lmtp_cb_noop < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing NOOP command < %s", req->msg);
/* RFC0821 4.2.1. REPLY CODES BY FUNCTION GROUPS 250 Requested mail action okay, completed
* RFC1893 2. Status Codes 2.X.X Success
@@ -1573,7 +1586,7 @@
lmtp_res_t res;
lmtp_rc_t rc = LMTP_OK;
- log1(ctx, INFO, "lmtp_cb_rset < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing RSET command < %s", req->msg);
lmtp_gfs_rset(ctx);
@@ -1590,7 +1603,7 @@
static void lmtp_gfs_rset(lmtp2nntp_t *ctx)
{
- log0(ctx, INFO, "lmtp_gfs_rset - graceful shutdown");
+ log0(ctx, TRACE, "LMTP service RSET command - graceful shutdown");
if (ctx->msg != NULL) {
msg_destroy(ctx->msg);
@@ -1604,7 +1617,7 @@
lmtp_res_t res;
lmtp_rc_t rc = LMTP_EOF;
- log1(ctx, INFO, "lmtp_cb_quit < %s", req->msg);
+ log1(ctx, INFO, "LMTP service executing QUIT command < %s", req->msg);
lmtp_gfs_quit(ctx);
@@ -1621,7 +1634,7 @@
static void lmtp_gfs_quit(lmtp2nntp_t *ctx)
{
- log0(ctx, INFO, "lmtp_gfs_quit - graceful shutdown");
+ log0(ctx, TRACE, "LMTP service QUIT command - graceful shutdown");
lmtp_gfs_rset(ctx);
resetsession(&ctx->session);
|