aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-02-03 02:55:59 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-02-03 02:55:59 +0000
commitd0c2c187633fa906eee672c21f46a2ac68148d15 (patch)
treefc51a3d3a52c16d7edc82f1a388f4107ea238d95
parentb7406a23e1b4e9279e7bffd88352a20574a45f62 (diff)
downloadfetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.tar.gz
fetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.tar.bz2
fetchmail-d0c2c187633fa906eee672c21f46a2ac68148d15.zip
Simplify error reporting further.
svn path=/trunk/; revision=2374
-rw-r--r--checkalias.c12
-rw-r--r--daemon.c12
-rw-r--r--driver.c121
-rw-r--r--etrn.c20
-rw-r--r--fetchmail.c42
-rw-r--r--fetchmail.h6
-rw-r--r--getpass.c3
-rw-r--r--imap.c84
-rw-r--r--interface.c25
-rw-r--r--pop3.c16
-rw-r--r--rcfile_y.y4
-rw-r--r--report.c63
-rw-r--r--rpa.c110
-rw-r--r--sink.c30
-rw-r--r--smtp.c20
-rw-r--r--socket.c17
-rw-r--r--xalloca.c5
-rw-r--r--xmalloc.c4
18 files changed, 280 insertions, 314 deletions
diff --git a/checkalias.c b/checkalias.c
index 4ddf6789..d3d1cb07 100644
--- a/checkalias.c
+++ b/checkalias.c
@@ -137,15 +137,15 @@ int is_host_alias(const char *name, struct query *ctl)
else if (((he_st = gethostbyname(ctl->server.truename)) != (struct hostent *)NULL) && ctl->server.checkalias)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Checking if %s is really the same node as %s\n"),ctl->server.truename,name);
+ report(stdout, _("Checking if %s is really the same node as %s\n"),ctl->server.truename,name);
if (is_ip_alias(ctl->server.truename,name) == TRUE)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Yes, their IP addresses match\n"));
+ report(stdout, _("Yes, their IP addresses match\n"));
goto match;
}
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("No, their IP addresses don't match\n"));
+ report(stdout, _("No, their IP addresses don't match\n"));
}
else
return(FALSE);
@@ -161,8 +161,8 @@ int is_host_alias(const char *name, struct query *ctl)
case TRY_AGAIN: /* temporary error on authoritative server */
default:
if (outlevel != O_SILENT)
- report_complete(stdout, 0, "\n"); /* terminate the progress message */
- report(stderr, 0,
+ report_complete(stdout, "\n"); /* terminate the progress message */
+ report(stderr,
_("nameserver failure while looking for `%s' during poll of %s.\n"),
name, ctl->server.pollname);
ctl->errcount++;
@@ -187,7 +187,7 @@ int is_host_alias(const char *name, struct query *ctl)
case NO_RECOVERY: /* non-recoverable name server error */
case TRY_AGAIN: /* temporary error on authoritative server */
default:
- report(stderr, 0,
+ report(stderr,
_("nameserver failure while looking for `%s' during poll of %s.\n"),
name, ctl->server.pollname);
ctl->errcount++;
diff --git a/daemon.c b/daemon.c
index 67ae0270..5937524b 100644
--- a/daemon.c
+++ b/daemon.c
@@ -109,7 +109,7 @@ daemonize (const char *logfile, void (*termhook)(int))
group leader */
if ((childpid = fork()) < 0) {
- report(stderr, errno, "fork\n");
+ report(stderr, "fork (%s)\n", strerror(errno));
return(PS_IOERR);
}
else if (childpid > 0)
@@ -122,7 +122,7 @@ daemonize (const char *logfile, void (*termhook)(int))
#if defined(HAVE_SETSID) /* POSIX */
/* POSIX makes this soooo easy to do */
if (setsid() < 0) {
- report(stderr, errno, "setsid\n");
+ report(stderr, "setsid (%s)\n", strerror(errno));
return(PS_IOERR);
}
#elif defined(SIGTSTP) /* BSD */
@@ -144,7 +144,7 @@ daemonize (const char *logfile, void (*termhook)(int))
/* lose controlling tty */
signal(SIGHUP, SIG_IGN);
if ((childpid = fork()) < 0) {
- report(stderr, errno, "fork\n");
+ report(stderr, "fork (%)\n", strerror(errno));
return(PS_IOERR);
}
else if (childpid > 0) {
@@ -168,7 +168,7 @@ nottyDetach:
/* Reopen stdin descriptor on /dev/null */
if ((fd = open("/dev/null", O_RDWR)) < 0) { /* stdin */
- report(stderr, errno, "open: /dev/null\n");
+ report(stderr, "open: /dev/null (%s)\n", strerror(errno));
return(PS_IOERR);
}
@@ -176,11 +176,11 @@ nottyDetach:
fd = open(logfile, O_CREAT|O_WRONLY|O_APPEND, 0666); /* stdout */
else
if (dup(fd) < 0) { /* stdout */
- report(stderr, errno, "dup\n");
+ report(stderr, "dup (%s)\n", strerror(errno));
return(PS_IOERR);
}
if (dup(fd) < 0) { /* stderr */
- report(stderr, errno, "dup\n");
+ report(stderr, "dup (%s)\n", strerror(errno));
return(PS_IOERR);
}
diff --git a/driver.c b/driver.c
index 218303df..5d64978e 100644
--- a/driver.c
+++ b/driver.c
@@ -132,7 +132,7 @@ static void map_name(const char *name, struct query *ctl, struct idlist **xmit_n
if (lname != (char *)NULL)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("mapped %s to local %s\n"), name, lname);
+ report(stdout, _("mapped %s to local %s\n"), name, lname);
save_str(xmit_names, lname, XMIT_ACCEPT);
accept_count++;
}
@@ -189,7 +189,7 @@ static void find_server_names(const char *hdr,
strcasecmp(rhs, idp->id) == 0)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("passed through %s matching %s\n"),
+ report(stdout, _("passed through %s matching %s\n"),
cp, idp->id);
save_str(xmit_names, cp, XMIT_ACCEPT);
accept_count++;
@@ -243,7 +243,7 @@ static char *parse_received(struct query *ctl, char *bufp)
* does this when the mail has a single recipient.
*/
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("analyzing Received line:\n%s"), bufp);
+ report(stdout, _("analyzing Received line:\n%s"), bufp);
/* search for whitepace-surrounded "by" followed by xxxx.yyyy */
for (base = bufp; ; base = ok + 2)
@@ -281,13 +281,13 @@ static char *parse_received(struct query *ctl, char *bufp)
if (is_host_alias(rbuf, ctl))
{
if (outlevel >= O_DEBUG)
- report(stdout, 0,
+ report(stdout,
_("line accepted, %s is an alias of the mailserver\n"), rbuf);
}
else
{
if (outlevel >= O_DEBUG)
- report(stdout, 0,
+ report(stdout,
_("line rejected, %s is not an alias of the mailserver\n"),
rbuf);
return(NULL);
@@ -359,7 +359,7 @@ static char *parse_received(struct query *ctl, char *bufp)
if (!ok)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("no Received address found\n"));
+ report(stdout, _("no Received address found\n"));
return(NULL);
}
else
@@ -368,7 +368,7 @@ static char *parse_received(struct query *ctl, char *bufp)
char *lf = rbuf + strlen(rbuf)-1;
*lf = '\0';
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("found Received address `%s'\n"), rbuf+2);
+ report(stdout, _("found Received address `%s'\n"), rbuf+2);
*lf = '\n';
}
return(rbuf);
@@ -732,7 +732,7 @@ static int readheaders(int sock,
if (!headers_ok)
{
if (outlevel > O_SILENT)
- report(stdout, 0,
+ report(stdout,
_("message delimiter found while scanning headers\n"));
}
@@ -869,7 +869,7 @@ static int readheaders(int sock,
no_local_matches = TRUE;
save_str(&msgblk.recipients, run.postmaster, XMIT_ACCEPT);
if (outlevel >= O_DEBUG)
- report(stdout, 0,
+ report(stdout,
_("no local matches, forwarding to %s\n"),
run.postmaster);
}
@@ -884,7 +884,7 @@ static int readheaders(int sock,
if (ctl->errcount > olderrs) /* there were DNS errors above */
{
if (outlevel >= O_DEBUG)
- report(stdout, 0,
+ report(stdout,
_("forwarding and deletion suppressed due to DNS errors\n"));
free(msgblk.headers);
free_str_list(&msgblk.recipients);
@@ -982,7 +982,7 @@ static int readheaders(int sock,
if (n == -1)
{
- report(stdout, errno, _("writing RFC822 msgblk.headers\n"));
+ report(stdout, _("writing RFC822 msgblk.headers\n"));
release_sink(ctl);
free(msgblk.headers);
free_str_list(&msgblk.recipients);
@@ -1141,7 +1141,7 @@ static int readbody(int sock, struct query *ctl, flag forward, int len)
if (n < 0)
{
- report(stdout, errno, _("writing message text\n"));
+ report(stdout, _("writing message text\n"));
release_sink(ctl);
return(PS_IOERR);
}
@@ -1184,7 +1184,7 @@ const char *canonical; /* server name */
"KPOPV0.1"));
if (rem != KSUCCESS)
{
- report(stderr, 0, _("kerberos error %s\n"), (krb_get_err_text (rem)));
+ report(stderr, _("kerberos error %s\n"), (krb_get_err_text (rem)));
return (PS_AUTHFAIL);
}
return (0);
@@ -1210,19 +1210,19 @@ const char *canonical; /* server name */
krb5_auth_con_init(context, &auth_context);
if (retval = krb5_cc_default(context, &ccdef)) {
- report(stderr, 0, "krb5_cc_default: %s\n", error_message(retval));
+ report(stderr, "krb5_cc_default: %s\n", error_message(retval));
return(PS_ERROR);
}
if (retval = krb5_cc_get_principal(context, ccdef, &client)) {
- report(stderr, 0, "krb5_cc_get_principal: %s\n", error_message(retval));
+ report(stderr, "krb5_cc_get_principal: %s\n", error_message(retval));
return(PS_ERROR);
}
if (retval = krb5_sname_to_principal(context, canonical, "pop",
KRB5_NT_UNKNOWN,
&server)) {
- report(stderr, 0, "krb5_sname_to_principal: %s\n", error_message(retval));
+ report(stderr, "krb5_sname_to_principal: %s\n", error_message(retval));
return(PS_ERROR);
}
@@ -1242,13 +1242,13 @@ const char *canonical; /* server name */
if (retval) {
if (err_ret && err_ret->text.length) {
- report(stderr, 0, _("krb5_sendauth: %s [server says '%*s'] \n"),
+ report(stderr, _("krb5_sendauth: %s [server says '%*s'] \n"),
error_message(retval),
err_ret->text.length,
err_ret->text.data);
krb5_free_error(context, err_ret);
} else
- report(stderr, 0, "krb5_sendauth: %s\n", error_message(retval));
+ report(stderr, "krb5_sendauth: %s\n", error_message(retval));
return(PS_ERROR);
}
@@ -1372,7 +1372,7 @@ const struct method *proto; /* protocol method table */
#ifndef KERBEROS_V4
if (ctl->server.preauthenticate == A_KERBEROS_V4)
{
- report(stderr, 0, _("Kerberos V4 support not linked.\n"));
+ report(stderr, _("Kerberos V4 support not linked.\n"));
return(PS_ERROR);
}
#endif /* KERBEROS_V4 */
@@ -1380,7 +1380,7 @@ const struct method *proto; /* protocol method table */
#ifndef KERBEROS_V5
if (ctl->server.preauthenticate == A_KERBEROS_V5)
{
- report(stderr, 0, _("Kerberos V5 support not linked.\n"));
+ report(stderr, _("Kerberos V5 support not linked.\n"));
return(PS_ERROR);
}
#endif /* KERBEROS_V5 */
@@ -1390,13 +1390,13 @@ const struct method *proto; /* protocol method table */
{
/* check for unsupported options */
if (ctl->flush) {
- report(stderr, 0,
+ report(stderr,
_("Option --flush is not supported with %s\n"),
proto->name);
return(PS_SYNTAX);
}
else if (ctl->fetchall) {
- report(stderr, 0,
+ report(stderr,
_("Option --all is not supported with %s\n"),
proto->name);
return(PS_SYNTAX);
@@ -1404,7 +1404,7 @@ const struct method *proto; /* protocol method table */
}
if (!proto->getsizes && NUM_SPECIFIED(ctl->limit))
{
- report(stderr, 0,
+ report(stderr,
_("Option --limit is not supported with %s\n"),
proto->name);
return(PS_SYNTAX);
@@ -1438,23 +1438,23 @@ const struct method *proto; /* protocol method table */
#endif /* HAVE_SIGPROCMASK */
if (phase == OPEN_WAIT)
- report(stdout, 0,
+ report(stdout,
_("timeout after %d seconds waiting to connect to server %s.\n"),
ctl->server.timeout, ctl->server.pollname);
else if (phase == SERVER_WAIT)
- report(stdout, 0,
+ report(stdout,
_("timeout after %d seconds waiting for server %s.\n"),
ctl->server.timeout, ctl->server.pollname);
else if (phase == FORWARDING_WAIT)
- report(stdout, 0,
+ report(stdout,
_("timeout after %d seconds waiting for %s.\n"),
ctl->server.timeout,
ctl->mda ? "MDA" : "SMTP");
else if (phase == LISTENER_WAIT)
- report(stdout, 0,
+ report(stdout,
_("timeout after %d seconds waiting for listener to respond.\n"));
else
- report(stdout, 0, _("timeout after %d seconds.\n"), ctl->server.timeout);
+ report(stdout, _("timeout after %d seconds.\n"), ctl->server.timeout);
release_sink(ctl);
if (ctl->smtp_socket != -1)
@@ -1504,7 +1504,7 @@ const struct method *proto; /* protocol method table */
/* execute pre-initialization command, if any */
if (ctl->preconnect && (ok = system(ctl->preconnect)))
{
- report(stderr, 0,
+ report(stderr,
_("pre-connection command failed with status %d\n"), ok);
ok = PS_SYNTAX;
goto closeUp;
@@ -1530,7 +1530,7 @@ const struct method *proto; /* protocol method table */
int err_no = errno;
#ifdef HAVE_RES_SEARCH
if (err_no != 0 && h_errno != 0)
- report(stderr, 0, _("fetchmail: internal inconsistency\n"));
+ report(stderr, _("fetchmail: internal inconsistency\n"));
#endif
/*
* Avoid generating a bogus error every poll cycle when we're
@@ -1540,26 +1540,25 @@ const struct method *proto; /* protocol method table */
if (err_no == EHOSTUNREACH && run.poll_interval)
goto ehostunreach;
- report_build(stderr, _("fetchmail: %s connection to %s failed\n"),
+ report_build(stderr, _("fetchmail: %s connection to %s failed"),
protocol->name, ctl->server.pollname);
#ifdef HAVE_RES_SEARCH
if (h_errno != 0)
{
if (h_errno == HOST_NOT_FOUND)
- report_complete(stderr, 0, _(": host is unknown\n"));
+ report_complete(stderr, _(": host is unknown\n"));
else if (h_errno == NO_ADDRESS)
- report_complete(stderr, 0, _(": name is valid but has no IP address\n"));
+ report_complete(stderr, _(": name is valid but has no IP address\n"));
else if (h_errno == NO_RECOVERY)
- report_complete(stderr, 0, _(": unrecoverable name server error\n"));
+ report_complete(stderr, _(": unrecoverable name server error\n"));
else if (h_errno == TRY_AGAIN)
- report_complete(stderr, 0, _(": temporary name server error\n"));
+ report_complete(stderr, _(": temporary name server error\n"));
else
- report_complete(stderr, 0, _(": unknown DNS error %d\n"), h_errno);
+ report_complete(stderr, _(": unknown DNS error %d\n"), h_errno);
}
else
#endif /* HAVE_RES_SEARCH */
-
- report_complete(stderr, err_no, "\n");
+ report_complete(stderr, ": %s\n", strerror(err_no));
ehostunreach:
#endif /* INET6 */
@@ -1610,14 +1609,14 @@ const struct method *proto; /* protocol method table */
if (ok != 0)
{
if (ok == PS_LOCKBUSY)
- report(stderr, 0, _("Lock-busy error on %s@%s\n"),
+ report(stderr, _("Lock-busy error on %s@%s\n"),
ctl->remotename,
ctl->server.truename);
else
{
if (ok == PS_ERROR)
ok = PS_AUTHFAIL;
- report(stderr, 0, _("Authorization failure on %s@%s\n"),
+ report(stderr, _("Authorization failure on %s@%s\n"),
ctl->remotename,
ctl->server.truename);
@@ -1660,9 +1659,9 @@ const struct method *proto; /* protocol method table */
if (outlevel >= O_DEBUG)
if (idp->id)
- report(stdout, 0, _("selecting or re-polling folder %s\n"), idp->id);
+ report(stdout, _("selecting or re-polling folder %s\n"), idp->id);
else
- report(stdout, 0, _("selecting or re-polling default folder\n"));
+ report(stdout, _("selecting or re-polling default folder\n"));
/* compute # of messages and number of new messages waiting */
ok = (protocol->getrange)(sock, ctl, idp->id, &count, &new, &bytes);
@@ -1678,7 +1677,7 @@ const struct method *proto; /* protocol method table */
ctl->remotename, ctl->server.truename);
if (outlevel > O_SILENT)
if (count == -1) /* only used for ETRN */
- report(stdout, 0, _("Polling %s\n"), ctl->server.truename);
+ report(stdout, _("Polling %s\n"), ctl->server.truename);
else if (count != 0)
{
if (new != -1 && (count - new) > 0)
@@ -1691,15 +1690,15 @@ const struct method *proto; /* protocol method table */
count, count > 1 ? _("messages") :
_("message"), buf);
if (bytes == -1)
- report_complete(stdout, 0, ".\n");
+ report_complete(stdout, ".\n");
else
- report_complete(stdout, 0, _(" (%d octets).\n"), bytes);
+ report_complete(stdout, _(" (%d octets).\n"), bytes);
}
else
{
/* these are pointless in normal daemon mode */
if (pass == 1 && (run.poll_interval == 0 || outlevel >= O_VERBOSE))
- report(stdout, 0, _("No mail for %s\n"), buf);
+ report(stdout, _("No mail for %s\n"), buf);
}
/* very important, this is where we leave the do loop */
@@ -1799,7 +1798,7 @@ const struct method *proto; /* protocol method table */
if (msgsizes && msgsizes[num-1] == -1)
{
if (outlevel >= O_VERBOSE)
- report(stdout, 0,
+ report(stdout,
_("Skipping message %d, length -1"),
num - 1);
continue;
@@ -1885,9 +1884,9 @@ const struct method *proto; /* protocol method table */
report_build(stdout, _(" (%d %soctets)"),
len, wholesize ? "" : _("header "));
if (outlevel >= O_VERBOSE)
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
else
- report_complete(stdout, 0, " ");
+ report_complete(stdout, " ");
}
/*
@@ -1931,7 +1930,7 @@ const struct method *proto; /* protocol method table */
if ((ok=(protocol->fetch_body)(sock,ctl,num,&len)))
goto cleanUp;
if (outlevel > O_SILENT && !wholesize)
- report_complete(stdout, 0,
+ report_complete(stdout,
_(" (%d body octets) "), len);
}
}
@@ -2003,7 +2002,7 @@ const struct method *proto; /* protocol method table */
if (msgsizes && msglen != msgsizes[num-1])
{
if (outlevel >= O_DEBUG)
- report(stdout, 0,
+ report(stdout,
_("message %d was not the expected length (%d actual != %d expected)\n"),
num, msglen, msgsizes[num-1]);
}
@@ -2042,7 +2041,7 @@ const struct method *proto; /* protocol method table */
if (retained)
{
if (outlevel > O_SILENT)
- report(stdout, 0, _(" retained\n"));
+ report(stdout, _(" retained\n"));
}
else if (protocol->delete
&& !suppress_delete
@@ -2050,7 +2049,7 @@ const struct method *proto; /* protocol method table */
{
deletions++;
if (outlevel > O_SILENT)
- report_complete(stdout, 0, _(" flushed\n"));
+ report_complete(stdout, _(" flushed\n"));
ok = (protocol->delete)(sock, ctl, num);
if (ok != 0)
goto cleanUp;
@@ -2059,13 +2058,13 @@ const struct method *proto; /* protocol method table */
#endif /* POP3_ENABLE */
}
else if (outlevel > O_SILENT)
- report_complete(stdout, 0, _(" not flushed\n"));
+ report_complete(stdout, _(" not flushed\n"));
/* perhaps this as many as we're ready to handle */
if (NUM_NONZERO(ctl->fetchlimit)
&& ctl->fetchlimit <= fetches)
{
- report(stdout, 0, _("fetchlimit reached; %d messages left on server\n"),
+ report(stdout, _("fetchlimit reached; %d messages left on server\n"),
count - fetches);
goto no_error;
}
@@ -2137,19 +2136,19 @@ const struct method *proto; /* protocol method table */
msg = _("DNS lookup");
break;
case PS_UNDEFINED:
- report(stderr, 0, _("undefined\n"));
+ report(stderr, _("undefined\n"));
break;
}
if (ok==PS_SOCKET || ok==PS_AUTHFAIL || ok==PS_SYNTAX
|| ok==PS_IOERR || ok==PS_ERROR || ok==PS_PROTOCOL
|| ok==PS_LOCKBUSY || ok==PS_SMTP)
- report(stderr,0, _("%s error while fetching from %s\n"), msg, ctl->server.pollname);
+ report(stderr, _("%s error while fetching from %s\n"), msg, ctl->server.pollname);
closeUp:
/* execute post-initialization command, if any */
if (ctl->postconnect && (ok = system(ctl->postconnect)))
{
- report(stderr, 0, _("post-connection command failed with status %d\n"), ok);
+ report(stderr, _("post-connection command failed with status %d\n"), ok);
if (ok == PS_SUCCESS)
ok = PS_SYNTAX;
}
@@ -2206,7 +2205,7 @@ va_dcl
*cp = '\0';
}
buf[strlen(buf)-2] = '\0';
- report(stdout, 0, "%s> %s\n", protocol->name, buf);
+ report(stdout, "%s> %s\n", protocol->name, buf);
}
}
@@ -2234,7 +2233,7 @@ int size; /* length of buffer */
if (buf[strlen(buf)-1] == '\r')
buf[strlen(buf)-1] = '\0';
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%s< %s\n", protocol->name, buf);
+ report(stdout, "%s< %s\n", protocol->name, buf);
phase = oldphase;
return(PS_SUCCESS);
}
@@ -2292,7 +2291,7 @@ va_dcl
*cp = '\0';
}
buf[strlen(buf)-1] = '\0';
- report(stdout, 0, "%s> %s\n", protocol->name, buf);
+ report(stdout, "%s> %s\n", protocol->name, buf);
}
/* we presume this does its own response echoing */
diff --git a/etrn.c b/etrn.c
index 49707a09..1d540c2b 100644
--- a/etrn.c
+++ b/etrn.c
@@ -39,13 +39,13 @@ static int etrn_getrange(int sock, struct query *ctl, const char *id,
if ((ok = SMTP_ehlo(sock, fetchmailhost, &opts)))
{
- report(stderr, 0, _("%s's SMTP listener does not support ESMTP\n"),
+ report(stderr, _("%s's SMTP listener does not support ESMTP\n"),
ctl->server.pollname);
return(ok);
}
else if (!(opts & ESMTP_ETRN))
{
- report(stderr, 0, _("%s's SMTP listener does not support ETRN\n"),
+ report(stderr, _("%s's SMTP listener does not support ETRN\n"),
ctl->server.pollname);
return(PS_PROTOCOL);
}
@@ -69,38 +69,38 @@ static int etrn_getrange(int sock, struct query *ctl, const char *id,
{
case 250: /* OK, queuing for node <x> started */
if (outlevel >= O_SILENT)
- report(stdout, 0, _("Queuing for %s started\n"), qnp->id);
+ report(stdout, _("Queuing for %s started\n"), qnp->id);
break;
case 251: /* OK, no messages waiting for node <x> */
if (outlevel >= O_SILENT)
- report(stdout, 0, _("No messages waiting for %s\n"), qnp->id);
+ report(stdout, _("No messages waiting for %s\n"), qnp->id);
return(PS_NOMAIL);
case 252: /* OK, pending messages for node <x> started */
case 253: /* OK, <n> pending messages for node <x> started */
if (outlevel >= O_SILENT)
- report(stdout, 0, _("Pending messages for %s started\n"), qnp->id);
+ report(stdout, _("Pending messages for %s started\n"), qnp->id);
break;
case 458: /* Unable to queue messages for node <x> */
- report(stderr, 0, _("Unable to queue messages for node %s\n"),qnp->id);
+ report(stderr, _("Unable to queue messages for node %s\n"),qnp->id);
return(PS_PROTOCOL);
case 459: /* Node <x> not allowed: <reason> */
- report(stderr, 0, _("Node %s not allowed: %s\n"), qnp->id, buf);
+ report(stderr, _("Node %s not allowed: %s\n"), qnp->id, buf);
return(PS_AUTHFAIL);
case 500: /* Syntax Error */
- report(stderr, 0, _("ETRN syntax error\n"));
+ report(stderr, _("ETRN syntax error\n"));
return(PS_PROTOCOL);
case 501: /* Syntax Error in Parameters */
- report(stderr, 0, _("ETRN syntax error in parameters\n"));
+ report(stderr, _("ETRN syntax error in parameters\n"));
return(PS_PROTOCOL);
default:
- report(stderr, 0, _("Unknown ETRN error %d\n"), atoi(buf));
+ report(stderr, _("Unknown ETRN error %d\n"), atoi(buf));
return(PS_PROTOCOL);
}
}
diff --git a/fetchmail.c b/fetchmail.c
index 9de42eb1..116adafa 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -464,7 +464,7 @@ int main (int argc, char **argv)
{
if (!nodetach)
daemonize(run.logfile, termhook);
- report(stdout, 0, _("starting fetchmail %s daemon \n"), VERSION);
+ report(stdout, _("starting fetchmail %s daemon \n"), VERSION);
/*
* We'll set up a handler for these when we're sleeping,
@@ -529,7 +529,7 @@ int main (int argc, char **argv)
{
if (ctl->wedged)
{
- report(stderr, 0,
+ report(stderr,
_("poll of %s skipped (failed authentication or too many timeouts)\n"),
ctl->server.pollname);
continue;
@@ -541,7 +541,7 @@ int main (int argc, char **argv)
if (ctl->server.poll_count++ % ctl->server.interval)
{
if (outlevel >= O_VERBOSE)
- report(stdout, 0,
+ report(stdout,
_("interval not reached, not querying %s\n"),
ctl->server.pollname);
continue;
@@ -569,13 +569,13 @@ int main (int argc, char **argv)
{
write_saved_lists(querylist, run.idfile);
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("saved UID List\n"));
+ report(stdout, _("saved UID List\n"));
}
#endif /* POP3_ENABLE */
}
else if (!check_only &&
((querystatus!=PS_NOMAIL) || (outlevel==O_DEBUG)))
- report(stdout, 0, _("Query status=%d\n"), querystatus);
+ report(stdout, _("Query status=%d\n"), querystatus);
#if defined(linux) && !INET6
if (ctl->server.monitor)
@@ -632,12 +632,12 @@ int main (int argc, char **argv)
unwedged++;
if (!unwedged)
{
- report(stderr, 0, _("All connections are wedged. Exiting.\n"));
+ report(stderr, _("All connections are wedged. Exiting.\n"));
exit(PS_AUTHFAIL);
}
if (outlevel >= O_VERBOSE)
- report(stdout, 0,
+ report(stdout,
_("fetchmail: sleeping at %s\n"), rfc822timestamp());
/*
@@ -733,10 +733,10 @@ int main (int argc, char **argv)
|| ((run.poll_interval && !getuid()) && lastsig == SIGHUP))
{
#ifdef SYS_SIGLIST_DECLARED
- report(stdout, 0,
+ report(stdout,
_("awakened by %s\n"), sys_siglist[lastsig]);
#else
- report(stdout, 0,
+ report(stdout,
_("awakened by signal %d\n"), lastsig);
#endif
/* received a wakeup - unwedge all servers in case */
@@ -752,13 +752,13 @@ int main (int argc, char **argv)
signal(SIGHUP, SIG_IGN);
if (outlevel >= O_VERBOSE)
- report(stdout, 0, _("awakened at %s\n"), rfc822timestamp());
+ report(stdout, _("awakened at %s\n"), rfc822timestamp());
}
} while
(run.poll_interval);
if (outlevel >= O_VERBOSE)
- report(stdout, 0, _("normal termination, status %d\n"),
+ report(stdout, _("normal termination, status %d\n"),
successes ? PS_SUCCESS : querystatus);
termhook(0);
@@ -1032,7 +1032,7 @@ static int load_params(int argc, char **argv, int optind)
free(ctl->server.via);
ctl->server.via = xstrdup(hes_p->po_host);
} else {
- report(stderr, errno,
+ report(stderr,
_("couldn't find HESIOD pobox for %s\n"),
ctl->remotename);
}
@@ -1058,7 +1058,7 @@ static int load_params(int argc, char **argv, int optind)
namerec = gethostbyname(ctl->server.queryname);
if (namerec == (struct hostent *)NULL)
{
- report(stderr, errno,
+ report(stderr,
_("couldn't find canonical DNS name of %s\n"),
ctl->server.pollname);
exit(PS_DNS);
@@ -1175,7 +1175,7 @@ static void termhook(int sig)
*/
if (sig != 0)
- report(stdout, 0, _("terminated with signal %d\n"), sig);
+ report(stdout, _("terminated with signal %d\n"), sig);
else
/* terminate all SMTP connections cleanly */
for (ctl = querylist; ctl; ctl = ctl->next)
@@ -1235,7 +1235,7 @@ static int query_host(struct query *ctl)
time_t now;
time(&now);
- report(stdout, 0, _("%s querying %s (protocol %s) at %s\n"),
+ report(stdout, _("%s querying %s (protocol %s) at %s\n"),
VERSION,
ctl->server.pollname,
showproto(ctl->server.protocol),
@@ -1256,7 +1256,7 @@ static int query_host(struct query *ctl)
#ifdef POP2_ENABLE
return(doPOP2(ctl));
#else
- report(stderr, 0, _("POP2 support is not configured.\n"));
+ report(stderr, _("POP2 support is not configured.\n"));
return(PS_PROTOCOL);
#endif /* POP2_ENABLE */
break;
@@ -1266,7 +1266,7 @@ static int query_host(struct query *ctl)
#ifdef POP3_ENABLE
return(doPOP3(ctl));
#else
- report(stderr, 0, _("POP3 support is not configured.\n"));
+ report(stderr, _("POP3 support is not configured.\n"));
return(PS_PROTOCOL);
#endif /* POP3_ENABLE */
break;
@@ -1278,24 +1278,24 @@ static int query_host(struct query *ctl)
#ifdef IMAP_ENABLE
return(doIMAP(ctl));
#else
- report(stderr, 0, _("IMAP support is not configured.\n"));
+ report(stderr, _("IMAP support is not configured.\n"));
return(PS_PROTOCOL);
#endif /* IMAP_ENABLE */
break;
case P_ETRN:
#ifndef ETRN_ENABLE
- report(stderr, 0, _("ETRN support is not configured.\n"));
+ report(stderr, _("ETRN support is not configured.\n"));
return(PS_PROTOCOL);
#else
#ifdef HAVE_GETHOSTBYNAME
return(doETRN(ctl));
#else
- report(stderr, 0, _("Cannot support ETRN without gethostbyname(2).\n"));
+ report(stderr, _("Cannot support ETRN without gethostbyname(2).\n"));
return(PS_PROTOCOL);
#endif /* HAVE_GETHOSTBYNAME */
#endif /* ETRN_ENABLE */
default:
- report(stderr, 0, _("unsupported protocol selected.\n"));
+ report(stderr, _("unsupported protocol selected.\n"));
return(PS_PROTOCOL);
}
}
diff --git a/fetchmail.h b/fetchmail.h
index f07f04ac..fa8a0e9e 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -343,9 +343,9 @@ extern char *sdps_envto;
/* error.c: Error reporting */
#if defined(HAVE_STDARG_H)
void report_init(int foreground);
-void report (FILE *fp, int errnum, const char *format, ...);
+void report (FILE *fp, const char *format, ...);
void report_build (FILE *fp, const char *format, ...);
-void report_complete (FILE *fp, int errnum, const char *format, ...);
+void report_complete (FILE *fp, const char *format, ...);
void report_at_line (FILE *fp, int, const char *, unsigned int, const char *, ...);
#else
void report ();
@@ -455,7 +455,7 @@ char *xstrdup(const char *);
#pragma alloca
#endif
#endif
-#define xalloca(ptr, t, n) if (!(ptr = (t) alloca(n))) report(stderr, PS_UNDEFINED, 0, "alloca failed")
+#define xalloca(ptr, t, n) if (!(ptr = (t) alloca(n))) {report(stderr, "alloca failed"); exit(PS_UNDEFINED);}
/* protocol driver and methods */
int do_protocol(struct query *, const struct method *);
diff --git a/getpass.c b/getpass.c
index 88c4a04c..fc021bae 100644
--- a/getpass.c
+++ b/getpass.c
@@ -190,7 +190,8 @@ static void restore_tty_state(void)
static RETSIGTYPE sigint_handler(int signum)
{
restore_tty_state();
- report(stderr, 1, 0, _("\nCaught signal... bailing out.\n"));
+ report(stderr, _("\nCaught signal... bailing out.\n"));
+ exit(1);
}
/* getpass.c ends here */
diff --git a/imap.c b/imap.c
index fdc6e023..3332cd3b 100644
--- a/imap.c
+++ b/imap.c
@@ -142,7 +142,7 @@ static int do_otp(int sock, struct query *ctl)
return rval;
if ((i = from64tobits(challenge, buffer)) < 0) {
- report(stderr, 0, _("Could not decode initial BASE64 challenge\n"));
+ report(stderr, _("Could not decode initial BASE64 challenge\n"));
return PS_AUTHFAIL;
};
@@ -150,7 +150,7 @@ static int do_otp(int sock, struct query *ctl)
to64frombits(buffer, ctl->remotename, strlen(ctl->remotename));
if (outlevel >= O_MONITOR)
- report(stdout, 0, "IMAP> %s\n", buffer);
+ report(stdout, "IMAP> %s\n", buffer);
SockWrite(sock, buffer, strlen(buffer));
SockWrite(sock, "\r\n", 2);
@@ -158,7 +158,7 @@ static int do_otp(int sock, struct query *ctl)
return rval;
if ((i = from64tobits(challenge, buffer)) < 0) {
- report(stderr, 0, _("Could not decode OTP challenge\n"));
+ report(stderr, _("Could not decode OTP challenge\n"));
return PS_AUTHFAIL;
};
@@ -177,7 +177,7 @@ static int do_otp(int sock, struct query *ctl)
to64frombits(buffer, response, strlen(response));
if (outlevel >= O_MONITOR)
- report(stdout, 0, "IMAP> %s\n", buffer);
+ report(stdout, "IMAP> %s\n", buffer);
SockWrite(sock, buffer, strlen(buffer));
SockWrite(sock, "\r\n", 2);
@@ -241,7 +241,7 @@ static int do_rfc1731(int sock, char *truename)
len = from64tobits(challenge1.cstr, buf1);
if (len < 0) {
- report(stderr, 0, _("could not decode initial BASE64 challenge\n"));
+ report(stderr, _("could not decode initial BASE64 challenge\n"));
return PS_AUTHFAIL;
}
@@ -270,13 +270,13 @@ static int do_rfc1731(int sock, char *truename)
result = krb_mk_req(&authenticator, "imap", srvinst, srvrealm, 0);
if (result) {
- report(stderr, 0, "krb_mq_req: %s\n", krb_get_err_text(result));
+ report(stderr, "krb_mq_req: %s\n", krb_get_err_text(result));
return PS_AUTHFAIL;
}
result = krb_get_cred("imap", srvinst, srvrealm, &credentials);
if (result) {
- report(stderr, 0, "krb_get_cred: %s\n", krb_get_err_text(result));
+ report(stderr, "krb_get_cred: %s\n", krb_get_err_text(result));
return PS_AUTHFAIL;
}
@@ -286,19 +286,19 @@ static int do_rfc1731(int sock, char *truename)
result = krb_get_tf_fullname(TKT_FILE, tktuser, tktinst, tktrealm);
if (result) {
- report(stderr, 0, "krb_get_tf_fullname: %s\n", krb_get_err_text(result));
+ report(stderr, "krb_get_tf_fullname: %s\n", krb_get_err_text(result));
return PS_AUTHFAIL;
}
if (strcmp(tktuser, user) != 0) {
- report(stderr, 0,
+ report(stderr,
_("principal %s in ticket does not match -u %s\n"), tktuser,
user);
return PS_AUTHFAIL;
}
if (tktinst[0]) {
- report(stderr, 0,
+ report(stderr,
_("non-null instance (%s) might cause strange behavior\n"),
tktinst);
strcat(tktuser, ".");
@@ -313,13 +313,13 @@ static int do_rfc1731(int sock, char *truename)
result = krb_mk_req(&authenticator, "imap", srvinst, srvrealm,
challenge1.cint);
if (result) {
- report(stderr, 0, "krb_mq_req: %s\n", krb_get_err_text(result));
+ report(stderr, "krb_mq_req: %s\n", krb_get_err_text(result));
return PS_AUTHFAIL;
}
to64frombits(buf1, authenticator.dat, authenticator.length);
if (outlevel >= O_MONITOR) {
- report(stdout, 0, "IMAP> %s\n", buf1);
+ report(stdout, "IMAP> %s\n", buf1);
}
SockWrite(sock, buf1, strlen(buf1));
SockWrite(sock, "\r\n", 2);
@@ -365,14 +365,14 @@ static int do_rfc1731(int sock, char *truename)
len = from64tobits(buf2, buf1);
if (len < 0) {
- report(stderr, 0, _("could not decode BASE64 ready response\n"));
+ report(stderr, _("could not decode BASE64 ready response\n"));
return PS_AUTHFAIL;
}
des_ecb_encrypt((des_cblock *)buf2, (des_cblock *)buf2, schedule, 0);
memcpy(challenge2.cstr, buf2, 4);
if (ntohl(challenge2.cint) != challenge1.cint + 1) {
- report(stderr, 0, _("challenge mismatch\n"));
+ report(stderr, _("challenge mismatch\n"));
return PS_AUTHFAIL;
}
@@ -402,7 +402,7 @@ static int do_rfc1731(int sock, char *truename)
to64frombits(buf1, authenticator.dat, authenticator.length);
if (outlevel >= O_MONITOR) {
- report(stdout, 0, "IMAP> %s\n", buf1);
+ report(stdout, "IMAP> %s\n", buf1);
}
SockWrite(sock, buf1, strlen(buf1));
SockWrite(sock, "\r\n", 2);
@@ -445,13 +445,13 @@ static int do_gssauth(int sock, char *hostname, char *username)
maj_stat = gss_import_name(&min_stat, &request_buf, gss_nt_service_name,
&target_name);
if (maj_stat != GSS_S_COMPLETE) {
- report(stderr, 0, _("Couldn't get service name for [%s]\n"), buf1);
+ report(stderr, _("Couldn't get service name for [%s]\n"), buf1);
return PS_AUTHFAIL;
}
else if (outlevel >= O_DEBUG) {
maj_stat = gss_display_name(&min_stat, target_name, &request_buf,
&mech_name);
- report(stderr, 0, _("Using service name [%s]\n"),request_buf.value);
+ report(stderr, _("Using service name [%s]\n"),request_buf.value);
maj_stat = gss_release_buffer(&min_stat, &request_buf);
}
@@ -467,13 +467,13 @@ static int do_gssauth(int sock, char *hostname, char *username)
sec_token = GSS_C_NO_BUFFER;
context = GSS_C_NO_CONTEXT;
if (outlevel >= O_VERBOSE)
- report(stdout, 0, _("Sending credentials\n"));
+ report(stdout, _("Sending credentials\n"));
do {
maj_stat = gss_init_sec_context(&min_stat, GSS_C_NO_CREDENTIAL,
&context, target_name, NULL, 0, 0, NULL, sec_token, NULL,
&send_token, &cflags, NULL);
if (maj_stat!=GSS_S_COMPLETE && maj_stat!=GSS_S_CONTINUE_NEEDED) {
- report(stderr, 0,_("Error exchanging credentials\n"));
+ report(stderr, _("Error exchanging credentials\n"));
gss_release_name(&min_stat, &target_name);
/* wake up server and await NO response */
SockWrite(sock, "\r\n", 2);
@@ -486,7 +486,7 @@ static int do_gssauth(int sock, char *hostname, char *username)
SockWrite(sock, buf1, strlen(buf1));
SockWrite(sock, "\r\n", 2);
if (outlevel >= O_MONITOR)
- report(stdout, 0, "IMAP> %s\n", buf1);
+ report(stdout, "IMAP> %s\n", buf1);
if (maj_stat == GSS_S_CONTINUE_NEEDED) {
if (result = gen_recv(sock, buf1, sizeof buf1)) {
gss_release_name(&min_stat, &target_name);
@@ -509,16 +509,16 @@ static int do_gssauth(int sock, char *hostname, char *username)
maj_stat = gss_unwrap(&min_stat, context, &request_buf, &send_token,
&cflags, &quality);
if (maj_stat != GSS_S_COMPLETE) {
- report(stderr, 0,_("Couldn't unwrap security level data\n"));
+ report(stderr, _("Couldn't unwrap security level data\n"));
gss_release_buffer(&min_stat, &send_token);
return PS_AUTHFAIL;
}
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Credential exchange complete\n"));
+ report(stdout, _("Credential exchange complete\n"));
/* first octet is security levels supported. We want none, for now */
server_conf_flags = ((char *)send_token.value)[0];
if ( !(((char *)send_token.value)[0] & GSSAUTH_P_NONE) ) {
- report(stderr, 0,_("Server requires integrity and/or privacy\n"));
+ report(stderr, _("Server requires integrity and/or privacy\n"));
gss_release_buffer(&min_stat, &send_token);
return PS_AUTHFAIL;
}
@@ -527,11 +527,11 @@ static int do_gssauth(int sock, char *hostname, char *username)
/* we don't care about buffer size if we don't wrap data */
gss_release_buffer(&min_stat, &send_token);
if (outlevel >= O_DEBUG) {
- report(stdout, 0, _("Unwrapped security level flags: %s%s%s\n"),
+ report(stdout, _("Unwrapped security level flags: %s%s%s\n"),
server_conf_flags & GSSAUTH_P_NONE ? "N" : "-",
server_conf_flags & GSSAUTH_P_INTEGRITY ? "I" : "-",
server_conf_flags & GSSAUTH_P_PRIVACY ? "C" : "-");
- report(stdout, 0, _("Maximum GSS token size is %ld\n"),buf_size);
+ report(stdout, _("Maximum GSS token size is %ld\n"),buf_size);
}
/* now respond in kind (hack!!!) */
@@ -544,13 +544,13 @@ static int do_gssauth(int sock, char *hostname, char *username)
maj_stat = gss_wrap(&min_stat, context, 0, GSS_C_QOP_DEFAULT, &request_buf,
&cflags, &send_token);
if (maj_stat != GSS_S_COMPLETE) {
- report(stderr, 0,_("Error creating security level request\n"));
+ report(stderr, _("Error creating security level request\n"));
return PS_AUTHFAIL;
}
to64frombits(buf1, send_token.value, send_token.length);
if (outlevel >= O_DEBUG) {
- report(stdout, 0, _("Requesting authorisation as %s\n"), username);
- report(stdout, 0, "IMAP> %s\n",buf1);
+ report(stdout, _("Requesting authorisation as %s\n"), username);
+ report(stdout, "IMAP> %s\n",buf1);
}
SockWrite(sock, buf1, strlen(buf1));
SockWrite(sock, "\r\n", 2);
@@ -561,10 +561,10 @@ static int do_gssauth(int sock, char *hostname, char *username)
if (strstr(buf1, "OK")) {
/* flush security context */
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Releasing GSS credentials\n"));
+ report(stdout, _("Releasing GSS credentials\n"));
maj_stat = gss_delete_sec_context(&min_stat, &context, &send_token);
if (maj_stat != GSS_S_COMPLETE) {
- report(stderr, 0, _("Error releasing credentials\n"));
+ report(stderr, _("Error releasing credentials\n"));
return PS_AUTHFAIL;
}
/* send_token may contain a notification to the server to flush
@@ -611,20 +611,20 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
{
imap_version = IMAP4rev1;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Protocol identified as IMAP4 rev 1\n"));
+ report(stdout, _("Protocol identified as IMAP4 rev 1\n"));
}
else
{
imap_version = IMAP4;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Protocol identified as IMAP4 rev 0\n"));
+ report(stdout, _("Protocol identified as IMAP4 rev 0\n"));
}
}
else if (ok == PS_ERROR)
{
imap_version = IMAP2;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Protocol identified as IMAP2 or IMAP2BIS\n"));
+ report(stdout, _("Protocol identified as IMAP2 or IMAP2BIS\n"));
}
else
return(ok);
@@ -635,7 +635,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
if ((ctl->server.protocol == P_IMAP) && strstr(capabilities, "AUTH=X-OTP"))
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("OTP authentication is supported\n"));
+ report(stdout, _("OTP authentication is supported\n"));
if (do_otp(sock, ctl) == PS_SUCCESS)
return(PS_SUCCESS);
};
@@ -647,13 +647,13 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
if (ctl->server.protocol == P_IMAP_GSS)
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("GSS authentication is supported\n"));
+ report(stdout, _("GSS authentication is supported\n"));
return do_gssauth(sock, ctl->server.truename, ctl->remotename);
}
}
else if (ctl->server.protocol == P_IMAP_GSS)
{
- report(stderr, 0,
+ report(stderr,
_("Required GSS capability not supported by server\n"));
return(PS_AUTHFAIL);
}
@@ -663,14 +663,14 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
if (strstr(capabilities, "AUTH=KERBEROS_V4"))
{
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("KERBEROS_V4 authentication is supported\n"));
+ report(stdout, _("KERBEROS_V4 authentication is supported\n"));
if (ctl->server.protocol == P_IMAP_K4)
{
if ((ok = do_rfc1731(sock, ctl->server.truename)))
{
if (outlevel >= O_MONITOR)
- report(stdout, 0, "IMAP> *\n");
+ report(stdout, "IMAP> *\n");
SockWrite(sock, "*\r\n", 3);
}
@@ -680,7 +680,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
}
else if (ctl->server.protocol == P_IMAP_K4)
{
- report(stderr, 0,
+ report(stderr,
_("Required KERBEROS_V4 capability not supported by server\n"));
return(PS_AUTHFAIL);
}
@@ -689,7 +689,7 @@ int imap_getauth(int sock, struct query *ctl, char *greeting)
#ifdef __UNUSED__ /* The Cyrus IMAP4rev1 server chokes on this */
/* this handles either AUTH=LOGIN or AUTH-LOGIN */
if ((imap_version >= IMAP4rev1) && (!strstr(capabilities, "LOGIN"))) {
- report(stderr, 0,
+ report(stderr,
_("Required LOGIN capability not supported by server\n"));
return PS_AUTHFAIL;
};
@@ -744,7 +744,7 @@ static int imap_getrange(int sock,
count = -1;
if (ok || gen_transact(sock, "NOOP"))
{
- report(stderr, 0, _("re-poll failed\n"));
+ report(stderr, _("re-poll failed\n"));
return(ok);
}
else if (count == -1) /* no EXISTS response to NOOP */
@@ -761,7 +761,7 @@ static int imap_getrange(int sock,
ok = gen_transact(sock, "EXAMINE %s", folder ? folder : "INBOX");
if (ok != 0)
{
- report(stderr, 0, _("mailbox selection failed\n"));
+ report(stderr, _("mailbox selection failed\n"));
return(ok);
}
}
diff --git a/interface.c b/interface.c
index 08978162..fafc32d4 100644
--- a/interface.c
+++ b/interface.c
@@ -193,8 +193,11 @@ void interface_parse(char *buf, struct hostdata *hp)
/* find and isolate just the IP address */
if (!(cp1 = strchr(buf, '/')))
- (void) report(stderr, PS_SYNTAX,
+ {
+ (void) report(stderr,
_("missing IP interface address\n"));
+ exit(PS_SYNTAX);
+ }
*cp1++ = '\000';
/* find and isolate just the netmask */
@@ -206,11 +209,17 @@ void interface_parse(char *buf, struct hostdata *hp)
/* convert IP address and netmask */
hp->interface_pair = (struct interface_pair_s *)xmalloc(sizeof(struct interface_pair_s));
if (!inet_aton(cp1, &hp->interface_pair->interface_address))
- (void) report(stderr, PS_SYNTAX,
+ {
+ (void) report(stderr,
_("invalid IP interface address\n"));
+ exit(PS_SYNTAX);
+ }
if (!inet_aton(cp2, &hp->interface_pair->interface_mask))
- (void) report(stderr, PS_SYNTAX,
+ {
+ (void) report(stderr,
_("invalid IP interface mask\n"));
+ exit(PS_SYNTAX);
+ }
/* apply the mask now to the IP address (range) required */
hp->interface_pair->interface_address.s_addr &=
hp->interface_pair->interface_mask.s_addr;
@@ -246,7 +255,7 @@ void interface_note_activity(struct hostdata *hp)
}
#ifdef ACTIVITY_DEBUG
- (void) report(stdout, 0,
+ (void) report(stdout,
_("activity on %s -noted- as %d\n"),
hp->monitor, hp->monitor_io);
#endif
@@ -261,7 +270,7 @@ int interface_approve(struct hostdata *hp)
if (hp->interface) {
/* get interface info */
if (!get_ifinfo(hp->interface, &ifinfo)) {
- (void) report(stdout, 0,
+ (void) report(stdout,
_("skipping poll of %s, %s down\n"),
hp->pollname, hp->interface);
return(FALSE);
@@ -270,7 +279,7 @@ int interface_approve(struct hostdata *hp)
if ((ifinfo.addr.s_addr &
hp->interface_pair->interface_mask.s_addr) !=
hp->interface_pair->interface_address.s_addr) {
- (void) report(stdout, 0,
+ (void) report(stdout,
_("skipping poll of %s, %s IP address excluded\n"),
hp->pollname, hp->interface);
return(FALSE);
@@ -282,7 +291,7 @@ int interface_approve(struct hostdata *hp)
return(TRUE);
#ifdef ACTIVITY_DEBUG
- (void) report(stdout, 0,
+ (void) report(stdout,
_("activity on %s checked as %d\n"),
hp->monitor, hp->monitor_io);
#endif
@@ -290,7 +299,7 @@ int interface_approve(struct hostdata *hp)
if (get_ifinfo(hp->monitor, &ifinfo) &&
hp->monitor_io == ifinfo.rx_packets +
ifinfo.tx_packets) {
- (void) report(stdout, 0,
+ (void) report(stdout,
_("skipping poll of %s, %s inactive\n"),
hp->pollname, hp->monitor);
return(FALSE);
diff --git a/pop3.c b/pop3.c
index 9a3ace32..f0f8fadb 100644
--- a/pop3.c
+++ b/pop3.c
@@ -92,7 +92,7 @@ int pop3_ok (int sock, char *argbuf)
else
ok = PS_AUTHFAIL;
if (*bufp)
- report(stderr, 0, "%s\n", bufp);
+ report(stderr, "%s\n", bufp);
}
else
ok = PS_PROTOCOL;
@@ -199,7 +199,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)
for (start = greeting; *start != 0 && *start != '<'; start++)
continue;
if (*start == 0) {
- report(stderr, 0,
+ report(stderr,
_("Required APOP timestamp not found in greeting\n"));
return(PS_AUTHFAIL);
}
@@ -208,7 +208,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)
for (end = start; *end != 0 && *end != '>'; end++)
continue;
if (*end == 0 || end == start + 1) {
- report(stderr, 0,
+ report(stderr,
_("Timestamp syntax error in greeting\n"));
return(PS_AUTHFAIL);
}
@@ -231,7 +231,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)
break;
default:
- report(stderr, 0, _("Undefined protocol request in POP3_auth\n"));
+ report(stderr, _("Undefined protocol request in POP3_auth\n"));
ok = PS_ERROR;
}
@@ -239,7 +239,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting)
{
/* maybe we detected a lock-busy condition? */
if (ok == PS_LOCKBUSY)
- report(stderr, 0, _("lock busy! Is another session active?\n"));
+ report(stderr, _("lock busy! Is another session active?\n"));
return(ok);
}
@@ -347,7 +347,7 @@ pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp)
try_id--;
}
} else {
- report(stderr, 0,
+ report(stderr,
_("Messages inserted into list on server. Cannot handle this.\n"));
return -1;
}
@@ -421,7 +421,7 @@ static int pop3_getrange(int sock,
{
if (sscanf(buf, "%d", &last) == 0)
{
- report(stderr, 0, _("protocol error\n"));
+ report(stderr, _("protocol error\n"));
return(PS_ERROR);
}
*newp = (*countp - last);
@@ -434,7 +434,7 @@ static int pop3_getrange(int sock,
/* don't worry, yet! do it the slow way */
if((ok = pop3_slowuidl( sock, ctl, countp, newp))!=0)
{
- report(stderr, 0, _("protocol error while fetching UIDLs\n"));
+ report(stderr, _("protocol error while fetching UIDLs\n"));
return(PS_ERROR);
}
}
diff --git a/rcfile_y.y b/rcfile_y.y
index a5e323d6..d688198c 100644
--- a/rcfile_y.y
+++ b/rcfile_y.y
@@ -375,7 +375,7 @@ int prc_filecheck(const char *pathname, const flag securecheck)
if (errno == ENOENT)
return(PS_SUCCESS);
else {
- report(stderr, errno, "lstat: %s\n", pathname);
+ report(stderr, "lstat: %s: %s\n", pathname, strerror(errno));
return(PS_IOERR);
}
}
@@ -423,7 +423,7 @@ int prc_parse_file (const char *pathname, const flag securecheck)
if (strcmp(pathname, "-") == 0)
yyin = stdin;
else if ((yyin = fopen(pathname,"r")) == (FILE *)NULL) {
- report(stderr, errno, "open: %s\n", pathname);
+ report(stderr, "open: %s: %s\n", pathname, strerror(errno));
return(PS_IOERR);
}
diff --git a/report.c b/report.c
index 2d53bb1a..5a33d71b 100644
--- a/report.c
+++ b/report.c
@@ -110,10 +110,9 @@ char *strerror (errnum)
void
#ifdef HAVE_STDARG_H
-report (FILE *errfp, int errnum, const char *message, ...)
+report (FILE *errfp, const char *message, ...)
#else
-report (FILE *errfp, errnum, message, va_alist)
- int errnum;
+report (FILE *errfp, message, va_alist)
const char *message;
va_dcl
#endif
@@ -137,40 +136,12 @@ report (FILE *errfp, errnum, message, va_alist)
#ifdef VA_START
VA_START (args, message);
#endif
- priority = errnum ? LOG_ERR : LOG_INFO;
-
- if (errnum > 0)
- {
- char *msg;
-
- xalloca(msg, char *, strlen (message) + 5);
-
- strcpy (msg, message);
- strcat (msg, ": %m");
+ priority = (errfp == stderr) ? LOG_ERR : LOG_INFO;
- errno = errnum;
-#ifdef HAVE_VSYSLOG
- vsyslog (priority, msg, args);
-#else
- {
- char *a1 = va_arg(args, char *);
- char *a2 = va_arg(args, char *);
- char *a3 = va_arg(args, char *);
- char *a4 = va_arg(args, char *);
- char *a5 = va_arg(args, char *);
- char *a6 = va_arg(args, char *);
- char *a7 = va_arg(args, char *);
- char *a8 = va_arg(args, char *);
- syslog (priority, msg, a1, a2, a3, a4, a5, a6, a7, a8);
- }
-#endif
- }
- else
- {
#ifdef HAVE_VSYSLOG
- vsyslog (priority, message, args);
+ vsyslog (priority, message, args);
#else
- {
+ {
char *a1 = va_arg(args, char *);
char *a2 = va_arg(args, char *);
char *a3 = va_arg(args, char *);
@@ -180,9 +151,8 @@ report (FILE *errfp, errnum, message, va_alist)
char *a7 = va_arg(args, char *);
char *a8 = va_arg(args, char *);
syslog (priority, message, a1, a2, a3, a4, a5, a6, a7, a8);
- }
+ }
#endif
- }
#ifdef VA_START
va_end(args);
@@ -215,16 +185,6 @@ report (FILE *errfp, errnum, message, va_alist)
#else
fprintf (errfp, message, a1, a2, a3, a4, a5, a6, a7, a8);
#endif
-
- if (errnum) {
- char *tmps = strerror(errnum);
- if (tmps) {
- fprintf (errfp, ": %s", tmps);
- }
- else {
- fprintf (errfp, _(": Error %d"), errnum);
- }
- }
fflush (errfp);
}
++error_message_count;
@@ -371,10 +331,9 @@ report_build (FILE *errfp, message, va_alist)
void
#ifdef HAVE_STDARG_H
-report_complete (FILE *errfp, int errnum, const char *message, ...)
+report_complete (FILE *errfp, const char *message, ...)
#else
-report_complete (FILE *errfp, errnum, message, va_alist)
- int errnum;
+report_complete (FILE *errfp, message, va_alist)
const char *message;
va_dcl
#endif
@@ -463,16 +422,12 @@ report_complete (FILE *errfp, errnum, message, va_alist)
if (use_stderr)
{
fputs(partial_message, errfp);
-
- if (errnum)
- fprintf (errfp, ": %s", strerror (errnum));
-
fflush (errfp);
++error_message_count;
}
else
- report (errfp, errnum, "%s", partial_message);
+ report(errfp, "%s", partial_message);
}
/* Sometimes we want to have at most one error per line. This
diff --git a/rpa.c b/rpa.c
index 6559ceb9..7e9dde6a 100644
--- a/rpa.c
+++ b/rpa.c
@@ -120,7 +120,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
SockPrintf(socket,"AUTH RPA\r\n");
if (outlevel >= O_MONITOR)
- report(stdout, 0, "> AUTH RPA\n");
+ report(stdout, "> AUTH RPA\n");
/* Create unicode user name in Nu. */
/* Create MD5 digest of user's passphrase in Pu */
@@ -134,7 +134,7 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
if ((ok = POP3_rpa_resp(buf,socket)) != 0)
{
if (outlevel > O_SILENT && outlevel < O_MONITOR)
- report(stdout, 0, "%s\n",buf);
+ report(stdout, "%s\n",buf);
return(ok);
}
@@ -156,17 +156,17 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
SockPrintf(socket,"%s\r\n",buf);
#endif
if (outlevel >= O_MONITOR)
- report(stdout, 0, "> %s\n",buf);
+ report(stdout, "> %s\n",buf);
if ((ok = POP3_rpa_resp(buf,socket)) != 0)
{
if (outlevel > O_SILENT && outlevel < O_MONITOR)
- report(stdout, 0, "%s\n",buf);
+ report(stdout, "%s\n",buf);
return(ok);
}
if ((rxlen = DecBase64(buf)) == 0)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA token 2: Base64 decode error\n"));
+ report(stderr, _("RPA token 2: Base64 decode error\n"));
return(PS_RPA);
}
bufp = buf;
@@ -177,35 +177,35 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
verh = *(bufp++); verl = *(bufp++);
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Service chose RPA version %d.%d\n"),verh,verl);
+ report(stdout, _("Service chose RPA version %d.%d\n"),verh,verl);
Csl = *(bufp++);
memcpy(Cs, bufp, Csl);
bufp += Csl;
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("Service challenge (l=%d):\n"),Csl);
+ report(stdout, _("Service challenge (l=%d):\n"),Csl);
for (i=0; i<Csl; i++)
report_build(stdout, "%02X ",Cs[i]);
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
memcpy(Ts, bufp, Tsl);
Ts[Tsl] = 0;
bufp += Tsl;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Service timestamp %s\n"),Ts);
+ report(stdout, _("Service timestamp %s\n"),Ts);
rll = *(bufp++) << 8; rll = rll | *(bufp++);
if ((bufp-buf+rll) != rxlen)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA token 2 length error\n"));
+ report(stderr, _("RPA token 2 length error\n"));
return(PS_RPA);
}
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Realm list: %s\n"),bufp);
+ report(stdout, _("Realm list: %s\n"),bufp);
if (SetRealmService(bufp) != 0)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA error in service@realm string\n"));
+ report(stderr, _("RPA error in service@realm string\n"));
return(PS_RPA);
}
@@ -232,17 +232,17 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
SockPrintf(socket,"%s\r\n",buf);
#endif
if (outlevel >= O_MONITOR)
- report(stdout, 0, "> %s\n",buf);
+ report(stdout, "> %s\n",buf);
if ((ok = POP3_rpa_resp(buf,socket)) != 0)
{
if (outlevel > O_SILENT && outlevel < O_MONITOR)
- report(stdout, 0, "%s\n",buf);
+ report(stdout, "%s\n",buf);
return(ok);
}
if ((rxlen = DecBase64(buf)) == 0)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA token 4: Base64 decode error\n"));
+ report(stderr, _("RPA token 4: Base64 decode error\n"));
return(PS_RPA);
}
bufp = buf;
@@ -253,10 +253,10 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
aulin = *(bufp++);
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("User authentication (l=%d):\n"),aulin);
+ report(stdout, _("User authentication (l=%d):\n"),aulin);
for (i=0; i<aulin; i++)
report_build(stdout, "%02X ",bufp[i]);
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
if (aulin == Aul) memcpy(Au, bufp, Aul);
bufp += aulin;
@@ -267,47 +267,47 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
{
status = *(bufp++);
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("RPA status: %02X\n"),status);
+ report(stdout, _("RPA status: %02X\n"),status);
}
else status = 0;
if ((bufp - buf) != rxlen)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA token 4 length error\n"));
+ report(stderr, _("RPA token 4 length error\n"));
return(PS_RPA);
}
if (status != 0)
{
if (outlevel > O_SILENT)
if (status < 4)
- report(stderr, 0, _("RPA rejects you: %s\n"),_(stdec[status]));
+ report(stderr, _("RPA rejects you: %s\n"),_(stdec[status]));
else
- report(stderr, 0, _("RPA rejects you, reason unknown\n"));
+ report(stderr, _("RPA rejects you, reason unknown\n"));
return(PS_AUTHFAIL);
}
if (Aul != aulin)
{
- report(stderr, 0,
+ report(stderr,
_("RPA User Authentication length error: %d\n"),aulin);
return(PS_RPA);
}
if (Kusl != kuslin)
{
- report(stderr, 0, _("RPA Session key length error: %d\n"),kuslin);
+ report(stderr, _("RPA Session key length error: %d\n"),kuslin);
return(PS_RPA);
}
if (CheckUserAuth() != 0)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA _service_ auth fail. Spoof server?\n"));
+ report(stderr, _("RPA _service_ auth fail. Spoof server?\n"));
return(PS_AUTHFAIL);
}
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("Session key established:\n"));
+ report(stdout, _("Session key established:\n"));
for (i=0; i<Kusl; i++)
report_build(stdout, "%02X ",Kus[i]);
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
/* Assemble Token 5 in buf and send (not in ver 2 though) */
@@ -325,17 +325,17 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket)
SockPrintf(socket,"%s\r\n",buf);
#endif
if (outlevel >= O_MONITOR)
- report(stdout, 0, "> %s\n",buf);
+ report(stdout, "> %s\n",buf);
if ((ok = POP3_rpa_resp(buf,socket)) != 0)
{
if (outlevel > O_SILENT && outlevel < O_MONITOR)
- report(stdout, 0, "%s\n",buf);
+ report(stdout, "%s\n",buf);
return(ok);
}
}
if (outlevel > O_SILENT)
- report(stdout, 0, _("RPA authorisation complete\n"));
+ report(stdout, _("RPA authorisation complete\n"));
return(PS_SUCCESS);
}
@@ -364,7 +364,7 @@ int socket;
int sockrc;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Get response\n"));
+ report(stdout, _("Get response\n"));
#ifndef TESTMODE
sockrc = gen_recv(socket, buf, sizeof(buf));
#else
@@ -372,7 +372,7 @@ int socket;
if (linecount == 1) strcpy(buf,line1);
if (linecount == 2) strcpy(buf,line2);
if (linecount == 3) strcpy(buf,line3);
-/* report(stdout, 0, "--> "); fflush(stderr); */
+/* report(stdout, "--> "); fflush(stderr); */
/* scanf("%s",&buf) */
sockrc = PS_SUCCESS;
#endif
@@ -394,7 +394,7 @@ int socket;
else
ok = PS_SOCKET;
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("Get response return %d [%s]\n"), ok, buf);
+ report(stdout, _("Get response return %d [%s]\n"), ok, buf);
buf[sockrc] = 0;
return(ok);
}
@@ -457,7 +457,7 @@ int rxlen;
if (**pptr != HDR)
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("Hdr not 60\n"));
+ report(stderr, _("Hdr not 60\n"));
return(0);
}
(*pptr)++;
@@ -478,18 +478,18 @@ int rxlen;
if (len==0)
{
if (outlevel>O_SILENT)
- report(stderr, 0, _("Token length error\n"));
+ report(stderr, _("Token length error\n"));
}
else if (((*pptr-save)+len) != rxlen)
{
if (outlevel>O_SILENT)
- report(stderr, 0, _("Token Length %d disagrees with rxlen %d\n"),len,rxlen);
+ report(stderr, _("Token Length %d disagrees with rxlen %d\n"),len,rxlen);
len = 0;
}
else if (memcmp(*pptr,MECH,11))
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("Mechanism field incorrect\n"));
+ report(stderr, _("Mechanism field incorrect\n"));
len = 0;
}
else (*pptr) += 11; /* Skip mechanism field */
@@ -526,7 +526,7 @@ unsigned char *bufp;
else if ( ch=='+' ) new = 62;
else if ( ch=='/' ) new = 63;
else {
- report(stderr, 0, _("dec64 error at char %d: %x\n"), inp - bufp, ch);
+ report(stderr, _("dec64 error at char %d: %x\n"), inp - bufp, ch);
return(0);
}
part=((part & 0x3F)*64) + new;
@@ -541,12 +541,12 @@ unsigned char *bufp;
}
if (outlevel >= O_MONITOR)
{
- report(stdout, 0, _("Inbound binary data:\n"));
+ report(stdout, _("Inbound binary data:\n"));
for (i=0; i<cnt; i++)
{
report_build(stdout, "%02X ",bufp[i]);
if (((i % 16)==15) || (i==(cnt-1)))
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
return(cnt);
@@ -579,12 +579,12 @@ int len;
if (outlevel >= O_MONITOR)
{
- report(stdout, 0, _("Outbound data:\n"));
+ report(stdout, _("Outbound data:\n"));
for (i=0; i<len; i++)
{
report_build(stdout, "%02X ",bufp[i]);
if (((i % 16)==15) || (i==(len-1)))
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
outp = bufp + (((len-1)/3)*4);
@@ -645,17 +645,17 @@ int conv;
if ( ((**pptr)!=delim) && ((**pptr)!=0) && ((*plen)==STRMAX) )
{
if (outlevel > O_SILENT)
- report(stderr, 0, _("RPA String too long\n"));
+ report(stderr, _("RPA String too long\n"));
*plen = 0;
}
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("Unicode:\n"));
+ report(stdout, _("Unicode:\n"));
for (i=0; i<(*plen); i++)
{
report_build(stdout, "%02X ",buf[i]);
if (((i % 16)==15) || (i==((*plen)-1)))
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
}
@@ -712,11 +712,11 @@ int len;
devrandom = fopen("/dev/urandom","rb");
if (devrandom == NULL && outlevel > O_SILENT)
{
- report(stdout, 0, _("RPA Failed open of /dev/urandom. This shouldn't\n"));
- report(stdout, 0, _(" prevent you logging in, but means you\n"));
- report(stdout, 0, _(" cannot be sure you are talking to the\n"));
- report(stdout, 0, _(" service that you think you are (replay\n"));
- report(stdout, 0, _(" attacks by a dishonest service are possible.)\n"));
+ report(stdout, _("RPA Failed open of /dev/urandom. This shouldn't\n"));
+ report(stdout, _(" prevent you logging in, but means you\n"));
+ report(stdout, _(" cannot be sure you are talking to the\n"));
+ report(stdout, _(" service that you think you are (replay\n"));
+ report(stdout, _(" attacks by a dishonest service are possible.)\n"));
}
for(i=0; i<len; i++)
@@ -727,12 +727,12 @@ int len;
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("User challenge:\n"));
+ report(stdout, _("User challenge:\n"));
for (i=0; i<len; i++)
{
report_build(stdout, "%02X ",buf[i]);
if (((i % 16)==15) || (i==(len-1)))
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
}
@@ -885,12 +885,12 @@ unsigned char* out;
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("MD5 being applied to data block:\n"));
+ report(stdout, _("MD5 being applied to data block:\n"));
for (i=0; i<len; i++)
{
report_build(stdout, "%02X ",in[i]);
if (((i % 16)==15) || (i==(len-1)))
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
MD5Init( &md5context );
@@ -898,12 +898,12 @@ unsigned char* out;
MD5Final( out, &md5context );
if (outlevel >= O_DEBUG)
{
- report(stdout, 0, _("MD5 result is: \n"));
+ report(stdout, _("MD5 result is: \n"));
for (i=0; i<16; i++)
{
report_build(stdout, "%02X ",out[i]);
}
- report_complete(stdout, 0, "\n");
+ report_complete(stdout, "\n");
}
}
#endif /* POP3_ENABLE && RPA_ENABLE */
diff --git a/sink.c b/sink.c
index a978c665..9a1ef93c 100644
--- a/sink.c
+++ b/sink.c
@@ -162,7 +162,7 @@ static int smtp_open(struct query *ctl)
ctl->destaddr = ctl->smtpaddress ? ctl->smtpaddress : ( ctl->smtphost ? ctl->smtphost : "localhost");
if (outlevel >= O_DEBUG && ctl->smtp_socket != -1)
- report(stdout, 0, _("forwarding to %s\n"), ctl->smtphost);
+ report(stdout, _("forwarding to %s\n"), ctl->smtphost);
return(ctl->smtp_socket);
}
@@ -284,7 +284,7 @@ static int send_bouncemail(struct msgblk *msg, int userclass,
ts = rfc822timestamp();
if (outlevel >= O_VERBOSE)
- report(stdout, 0, "SMTP: (bounce-message body)\n");
+ report(stdout, "SMTP: (bounce-message body)\n");
/* bouncemail headers */
SockPrintf(sock, "Return-Path: <>\r\n");
@@ -411,7 +411,7 @@ static int handle_smtp_report(struct query *ctl, struct msgblk *msg)
* an error when the return code is less specific.
*/
if (smtperr >= 400)
- report(stderr, 0, _("%cMTP error: %s\n"),
+ report(stderr, _("%cMTP error: %s\n"),
ctl->listener,
smtp_response);
@@ -516,7 +516,7 @@ int open_sink(struct query *ctl, struct msgblk *msg,
if (ferror(sinkfp))
{
- report(stderr, 0, _("BSMTP file open or preamble write failed\n"));
+ report(stderr, _("BSMTP file open or preamble write failed\n"));
return(PS_BSMTP);
}
}
@@ -637,7 +637,7 @@ int open_sink(struct query *ctl, struct msgblk *msg,
if (outlevel >= O_DEBUG)
- report(stdout, 0, _("about to deliver with: %s\n"), before);
+ report(stdout, _("about to deliver with: %s\n"), before);
#ifdef HAVE_SETEUID
/*
@@ -660,7 +660,7 @@ int open_sink(struct query *ctl, struct msgblk *msg,
if (!sinkfp)
{
- report(stderr, 0, _("MDA open failed\n"));
+ report(stderr, _("MDA open failed\n"));
return(PS_IOERR);
}
@@ -677,7 +677,7 @@ int open_sink(struct query *ctl, struct msgblk *msg,
/* build a connection to the SMTP listener */
if ((smtp_open(ctl) == -1))
{
- report(stderr, errno, _("%cMTP connect to %s failed\n"),
+ report(stderr, _("%cMTP connect to %s failed\n"),
ctl->listener,
ctl->smtphost ? ctl->smtphost : "localhost");
return(PS_SMTP);
@@ -755,7 +755,7 @@ int open_sink(struct query *ctl, struct msgblk *msg,
(*bad_addresses)++;
idp->val.status.mark = XMIT_RCPTBAD;
if (outlevel >= O_VERBOSE)
- report(stderr, 0,
+ report(stderr,
_("%cMTP listener doesn't like recipient address `%s'\n"),
ctl->listener, addr);
}
@@ -786,13 +786,13 @@ int open_sink(struct query *ctl, struct msgblk *msg,
if (SMTP_rcpt(ctl->smtp_socket, addr) != SM_OK)
{
- report(stderr, 0, _("can't even send to %s!\n"), run.postmaster);
+ report(stderr, _("can't even send to %s!\n"), run.postmaster);
SMTP_rset(ctl->smtp_socket); /* required by RFC1870 */
return(PS_SMTP);
}
if (outlevel >= O_VERBOSE)
- report(stderr, 0, _("no address matches; forwarding to %s.\n"), run.postmaster);
+ report(stderr, _("no address matches; forwarding to %s.\n"), run.postmaster);
}
/*
@@ -846,7 +846,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
signal(SIGCHLD, sigchld);
if (rc)
{
- report(stderr, 0,
+ report(stderr,
_("MDA exited abnormally or returned nonzero status\n"));
return(FALSE);
}
@@ -859,7 +859,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
fclose(sinkfp);
if (ferror(sinkfp))
{
- report(stderr, 0,
+ report(stderr,
_("Message termination or close of BSMTP file failed\n"));
return(FALSE);
}
@@ -873,7 +873,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
return(FALSE);
else
{
- report(stderr, 0, _("SMTP listener refused delivery\n"));
+ report(stderr, _("SMTP listener refused delivery\n"));
return(TRUE);
}
}
@@ -901,9 +901,9 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward)
* comply.
*/
if (atoi(smtp_response) == 503)
- report(stderr, 0, _("LMTP delivery error on EOM\n"));
+ report(stderr, _("LMTP delivery error on EOM\n"));
else
- report(stderr, 0,
+ report(stderr,
_("Unexpected non-503 response to LMTP EOM: %s\n"),
smtp_response);
diff --git a/smtp.c b/smtp.c
index c28fa66e..edb6e151 100644
--- a/smtp.c
+++ b/smtp.c
@@ -47,7 +47,7 @@ int SMTP_helo(int sock,const char *host)
SockPrintf(sock,"HELO %s\r\n", host);
if (outlevel >= O_MONITOR)
- report(stdout, 0, "SMTP> HELO %s\n", host);
+ report(stdout, "SMTP> HELO %s\n", host);
ok = SMTP_ok(sock);
return ok;
}
@@ -59,7 +59,7 @@ int SMTP_ehlo(int sock, const char *host, int *opt)
SockPrintf(sock,"%cHLO %s\r\n", (smtp_mode == 'S') ? 'E' : smtp_mode, host);
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> %cHLO %s\n",
+ report(stdout, "%cMTP> %cHLO %s\n",
smtp_mode, (smtp_mode == 'S') ? 'E' : smtp_mode, host);
*opt = 0;
@@ -75,7 +75,7 @@ int SMTP_ehlo(int sock, const char *host, int *opt)
return SM_ERROR;
smtp_response[n] = '\0';
if (outlevel >= O_MONITOR)
- report(stdout, 0, "SMTP< %s\n", smtp_response);
+ report(stdout, "SMTP< %s\n", smtp_response);
for (hp = extensions; hp->name; hp++)
if (!strncasecmp(hp->name, smtp_response+4, strlen(hp->name)))
*opt |= hp->value;
@@ -101,7 +101,7 @@ int SMTP_from(int sock, const char *from, const char *opts)
strcat(buf, opts);
SockPrintf(sock,"%s\r\n", buf);
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> %s\n", smtp_mode, buf);
+ report(stdout, "%cMTP> %s\n", smtp_mode, buf);
ok = SMTP_ok(sock);
return ok;
}
@@ -113,7 +113,7 @@ int SMTP_rcpt(int sock, const char *to)
SockPrintf(sock,"RCPT TO:<%s>\r\n", to);
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> RCPT TO:<%s>\n", smtp_mode, to);
+ report(stdout, "%cMTP> RCPT TO:<%s>\n", smtp_mode, to);
ok = SMTP_ok(sock);
return ok;
}
@@ -125,7 +125,7 @@ int SMTP_data(int sock)
SockPrintf(sock,"DATA\r\n");
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> DATA\n", smtp_mode);
+ report(stdout, "%cMTP> DATA\n", smtp_mode);
ok = SMTP_ok(sock);
return ok;
}
@@ -137,7 +137,7 @@ int SMTP_rset(int sock)
SockPrintf(sock,"RSET\r\n");
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> RSET\n", smtp_mode);
+ report(stdout, "%cMTP> RSET\n", smtp_mode);
ok = SMTP_ok(sock);
return ok;
}
@@ -149,7 +149,7 @@ int SMTP_quit(int sock)
SockPrintf(sock,"QUIT\r\n");
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP> QUIT\n", smtp_mode);
+ report(stdout, "%cMTP> QUIT\n", smtp_mode);
ok = SMTP_ok(sock);
return ok;
}
@@ -161,7 +161,7 @@ int SMTP_eom(int sock)
SockPrintf(sock,".\r\n");
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP>. (EOM)\n", smtp_mode);
+ report(stdout, "%cMTP>. (EOM)\n", smtp_mode);
/*
* When doing LMTP, must process many of these at the outer level.
@@ -189,7 +189,7 @@ int SMTP_ok(int sock)
return SM_ERROR;
smtp_response[n] = '\0';
if (outlevel >= O_MONITOR)
- report(stdout, 0, "%cMTP< %s\n", smtp_mode, smtp_response);
+ report(stdout, "%cMTP< %s\n", smtp_mode, smtp_response);
if ((smtp_response[0] == '1' || smtp_response[0] == '2' || smtp_response[0] == '3') && smtp_response[3] == ' ')
return SM_OK;
else if (smtp_response[3] != '-')
diff --git a/socket.c b/socket.c
index d95c043d..8f559799 100644
--- a/socket.c
+++ b/socket.c
@@ -52,13 +52,13 @@ static int handle_plugin(const char *host,
int fds[2];
if (socketpair(AF_UNIX,SOCK_STREAM,0,fds))
{
- report(stderr, errno, _("fetchmail: socketpair failed\n"));
+ report(stderr, _("fetchmail: socketpair failed\n"));
return -1;
}
switch (fork()) {
case -1:
/* error */
- report(stderr, errno, _("fetchmail: fork failed\n"));
+ report(stderr, _("fetchmail: fork failed\n"));
return -1;
break;
case 0: /* child */
@@ -66,15 +66,15 @@ static int handle_plugin(const char *host,
** detection */
(void) close(fds[1]);
if ( (dup2(fds[0],0) == -1) || (dup2(fds[0],1) == -1) ) {
- report(stderr, errno, _("dup2 failed\n"));
+ report(stderr, _("dup2 failed\n"));
exit(1);
}
/* fds[0] is now connected to 0 and 1; close it */
(void) close(fds[0]);
if (outlevel >= O_VERBOSE)
- report(stderr, 0, _("running %s %s %s\n"), plugin, host, service);
+ report(stderr, _("running %s %s %s\n"), plugin, host, service);
execlp(plugin,plugin,host,service,0);
- report(stderr, errno, _("execl(%s) failed\n"), plugin);
+ report(stderr, _("execl(%s) failed\n"), plugin);
exit(0);
break;
default: /* parent */
@@ -91,7 +91,6 @@ static int handle_plugin(const char *host,
int SockOpen(const char *host, const char *service, const char *options,
const char *plugin)
{
- int i;
struct addrinfo *ai, req;
#if NET_SECURITY
void *request = NULL;
@@ -105,8 +104,8 @@ int SockOpen(const char *host, const char *service, const char *options,
memset(&req, 0, sizeof(struct addrinfo));
req.ai_socktype = SOCK_STREAM;
- if (i = getaddrinfo(host, service, &req, &ai)) {
- report(stderr, i, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service);
+ if (getaddrinfo(host, service, &req, &ai)) {
+ report(stderr, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service);
return -1;
};
@@ -186,7 +185,7 @@ int SockOpen(const char *host, int clientPort, const char *options,
if(hp->h_length != 4 && hp->h_length != 8)
{
h_errno = errno = 0;
- report(stderr, 0,
+ report(stderr,
_("fetchmail: illegal address length received for host %s\n"),host);
return -1;
}
diff --git a/xalloca.c b/xalloca.c
index 769d70b9..2bb4e4ed 100644
--- a/xalloca.c
+++ b/xalloca.c
@@ -40,7 +40,10 @@ int n;
p = (XALLOCATYPE *) alloca(n);
if (p == (XALLOCATYPE *) 0)
- report(stderr, PS_UNDEFINED, 0, "alloca failed\n");
+ {
+ report(stderr, "alloca failed\n");
+ exit(PS_UNDEFINED);
+ }
return(p);
}
diff --git a/xmalloc.c b/xmalloc.c
index f967b8e5..2b343fe4 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -29,7 +29,7 @@ xmalloc (int n)
p = (XMALLOCTYPE *) malloc(n);
if (p == (XMALLOCTYPE *) 0)
{
- report(stderr, errno, _("malloc failed\n"));
+ report(stderr, _("malloc failed\n"));
exit(PS_UNDEFINED);
}
return(p);
@@ -43,7 +43,7 @@ xrealloc (XMALLOCTYPE *p, int n)
p = (XMALLOCTYPE *) realloc(p, n);
if (p == (XMALLOCTYPE *) 0)
{
- report(stderr, errno, _("realloc failed\n"));
+ report(stderr, _("realloc failed\n"));
exit(PS_UNDEFINED);
}
return p;