diff options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | checkalias.c | 12 | ||||
-rw-r--r-- | daemon.c | 12 | ||||
-rw-r--r-- | driver.c | 144 | ||||
-rw-r--r-- | etrn.c | 20 | ||||
-rw-r--r-- | fetchmail.c | 41 | ||||
-rw-r--r-- | getpass.c | 2 | ||||
-rw-r--r-- | imap.c | 89 | ||||
-rw-r--r-- | interface.c | 31 | ||||
-rw-r--r-- | pop3.c | 18 | ||||
-rw-r--r-- | rcfile_y.y | 4 | ||||
-rw-r--r-- | report.c | 2 | ||||
-rw-r--r-- | rfc822.c | 2 | ||||
-rw-r--r-- | rpa.c | 36 | ||||
-rw-r--r-- | sink.c | 32 | ||||
-rw-r--r-- | smtp.c | 20 | ||||
-rw-r--r-- | socket.c | 15 | ||||
-rw-r--r-- | xalloca.c | 2 | ||||
-rw-r--r-- | xmalloc.c | 4 |
19 files changed, 259 insertions, 228 deletions
@@ -11,6 +11,7 @@ fetchmail-4.7.7 (): * Added MD5 checksums to web page. * Get kernel type (and derive /proc/net/dev format) at startup. * Fixes for fetchmailconf bugs reported by Gunther Leber. +* Return of the dancing progress dots! There are 263 people on fetchmail-friends and 342 on fetchmail-announce. diff --git a/checkalias.c b/checkalias.c index d48826dd..4ddf6789 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"),ctl->server.truename,name); + report(stdout, 0, _("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")); + report(stdout, 0, _("Yes, their IP addresses match\n")); goto match; } if (outlevel >= O_DEBUG) - report(stdout, 0, _("No, their IP addresses don't match")); + report(stdout, 0, _("No, their IP addresses don't match\n")); } else return(FALSE); @@ -161,9 +161,9 @@ 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, ""); /* terminate the progress message */ + report_complete(stdout, 0, "\n"); /* terminate the progress message */ report(stderr, 0, - _("nameserver failure while looking for `%s' during poll of %s."), + _("nameserver failure while looking for `%s' during poll of %s.\n"), name, ctl->server.pollname); ctl->errcount++; break; @@ -188,7 +188,7 @@ int is_host_alias(const char *name, struct query *ctl) case TRY_AGAIN: /* temporary error on authoritative server */ default: report(stderr, 0, - _("nameserver failure while looking for `%s' during poll of %s."), + _("nameserver failure while looking for `%s' during poll of %s.\n"), name, ctl->server.pollname); ctl->errcount++; break; @@ -109,7 +109,7 @@ daemonize (const char *logfile, void (*termhook)(int)) group leader */ if ((childpid = fork()) < 0) { - report(stderr, errno, "fork"); + report(stderr, errno, "fork\n"); 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"); + report(stderr, errno, "setsid\n"); 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"); + report(stderr, errno, "fork\n"); 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"); + report(stderr, errno, "open: /dev/null\n"); 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"); + report(stderr, errno, "dup\n"); return(PS_IOERR); } if (dup(fd) < 0) { /* stderr */ - report(stderr, errno, "dup"); + report(stderr, errno, "dup\n"); return(PS_IOERR); } @@ -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"), name, lname); + report(stdout, 0, _("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"), + report(stdout, 0, _("passed through %s matching %s\n"), cp, idp->id); save_str(xmit_names, cp, XMIT_ACCEPT); accept_count++; @@ -282,13 +282,13 @@ static char *parse_received(struct query *ctl, char *bufp) { if (outlevel >= O_DEBUG) report(stdout, 0, - _("line accepted, %s is an alias of the mailserver"), rbuf); + _("line accepted, %s is an alias of the mailserver\n"), rbuf); } else { if (outlevel >= O_DEBUG) report(stdout, 0, - _("line rejected, %s is not an alias of the mailserver"), + _("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")); + report(stdout, 0, _("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'"), rbuf+2); + report(stdout, 0, _("found Received address `%s'\n"), rbuf+2); *lf = '\n'; } return(rbuf); @@ -499,7 +499,8 @@ static int readheaders(int sock, sizeticker += linelen; while (sizeticker >= SIZETICKER) { - report_build(stdout, "."); + fputc('.', stdout); + fflush(stdout); sizeticker -= SIZETICKER; } } @@ -732,7 +733,7 @@ static int readheaders(int sock, { if (outlevel > O_SILENT) report(stdout, 0, - _("message delimiter found while scanning headers")); + _("message delimiter found while scanning headers\n")); } /* @@ -869,7 +870,7 @@ static int readheaders(int sock, save_str(&msgblk.recipients, run.postmaster, XMIT_ACCEPT); if (outlevel >= O_DEBUG) report(stdout, 0, - _("no local matches, forwarding to %s"), + _("no local matches, forwarding to %s\n"), run.postmaster); } } @@ -884,7 +885,7 @@ static int readheaders(int sock, { if (outlevel >= O_DEBUG) report(stdout, 0, - _("forwarding and deletion suppressed due to DNS errors")); + _("forwarding and deletion suppressed due to DNS errors\n")); free(msgblk.headers); free_str_list(&msgblk.recipients); return(PS_TRANSIENT); @@ -981,7 +982,7 @@ static int readheaders(int sock, if (n == -1) { - report(stdout, errno, _("writing RFC822 msgblk.headers")); + report(stdout, errno, _("writing RFC822 msgblk.headers\n")); release_sink(ctl); free(msgblk.headers); free_str_list(&msgblk.recipients); @@ -1007,7 +1008,7 @@ static int readheaders(int sock, for (idp = msgblk.recipients; idp; idp = idp->next) if (idp->val.status.mark == XMIT_REJECT) break; - sprintf(errhd+strlen(errhd), _("recipient address %s didn't match any local name"), idp->id); + sprintf(errhd+strlen(errhd), _("recipient address %s didn't match any local name\n"), idp->id); } } @@ -1089,7 +1090,10 @@ static int readbody(int sock, struct query *ctl, flag forward, int len) while (sizeticker >= SIZETICKER) { if (!run.use_syslog && outlevel > O_SILENT) - report_build(stdout, "."); + { + fputc('.', stdout); + fflush(stdout); + } sizeticker -= SIZETICKER; } } @@ -1137,7 +1141,7 @@ static int readbody(int sock, struct query *ctl, flag forward, int len) if (n < 0) { - report(stdout, errno, _("writing message text")); + report(stdout, errno, _("writing message text\n")); release_sink(ctl); return(PS_IOERR); } @@ -1180,7 +1184,7 @@ const char *canonical; /* server name */ "KPOPV0.1")); if (rem != KSUCCESS) { - report(stderr, 0, _("kerberos error %s"), (krb_get_err_text (rem))); + report(stderr, 0, _("kerberos error %s\n"), (krb_get_err_text (rem))); return (PS_AUTHFAIL); } return (0); @@ -1206,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", error_message(retval)); + report(stderr, 0, "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", error_message(retval)); + report(stderr, 0, "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", error_message(retval)); + report(stderr, 0, "krb5_sname_to_principal: %s\n", error_message(retval)); return(PS_ERROR); } @@ -1238,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'] "), + report(stderr, 0, _("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", error_message(retval)); + report(stderr, 0, "krb5_sendauth: %s\n", error_message(retval)); return(PS_ERROR); } @@ -1333,7 +1337,7 @@ static void send_size_warnings(struct query *ctl) nbr = current->val.status.mark; size = atoi(current->id); stuff_warning(ctl, - _("\t%d msg %d octets long skipped by fetchmail."), + _("\t%d msg %d octets long skipped by fetchmail.\n"), nbr, size); } current->val.status.num++; @@ -1368,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.")); + report(stderr, 0, _("Kerberos V4 support not linked.\n")); return(PS_ERROR); } #endif /* KERBEROS_V4 */ @@ -1376,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.")); + report(stderr, 0, _("Kerberos V5 support not linked.\n")); return(PS_ERROR); } #endif /* KERBEROS_V5 */ @@ -1387,13 +1391,13 @@ const struct method *proto; /* protocol method table */ /* check for unsupported options */ if (ctl->flush) { report(stderr, 0, - _("Option --flush is not supported with %s"), + _("Option --flush is not supported with %s\n"), proto->name); return(PS_SYNTAX); } else if (ctl->fetchall) { report(stderr, 0, - _("Option --all is not supported with %s"), + _("Option --all is not supported with %s\n"), proto->name); return(PS_SYNTAX); } @@ -1401,7 +1405,7 @@ const struct method *proto; /* protocol method table */ if (!proto->getsizes && NUM_SPECIFIED(ctl->limit)) { report(stderr, 0, - _("Option --limit is not supported with %s"), + _("Option --limit is not supported with %s\n"), proto->name); return(PS_SYNTAX); } @@ -1435,22 +1439,22 @@ const struct method *proto; /* protocol method table */ if (phase == OPEN_WAIT) report(stdout, 0, - _("timeout after %d seconds waiting to connect to server %s."), + _("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, - _("timeout after %d seconds waiting for server %s."), + _("timeout after %d seconds waiting for server %s.\n"), ctl->server.timeout, ctl->server.pollname); else if (phase == FORWARDING_WAIT) report(stdout, 0, - _("timeout after %d seconds waiting for %s."), + _("timeout after %d seconds waiting for %s.\n"), ctl->server.timeout, ctl->mda ? "MDA" : "SMTP"); else if (phase == LISTENER_WAIT) report(stdout, 0, - _("timeout after %d seconds waiting for listener to respond.")); + _("timeout after %d seconds waiting for listener to respond.\n")); else - report(stdout, 0, _("timeout after %d seconds."), ctl->server.timeout); + report(stdout, 0, _("timeout after %d seconds.\n"), ctl->server.timeout); release_sink(ctl); if (ctl->smtp_socket != -1) @@ -1468,7 +1472,7 @@ const struct method *proto; /* protocol method table */ stuff_warning(ctl, _("Subject: fetchmail sees repeated timeouts\r\n")); stuff_warning(ctl, - _("Fetchmail saw more than %d timouts while attempting to get mail from %s@%s."), + _("Fetchmail saw more than %d timouts while attempting to get mail from %s@%s.\n"), MAX_TIMEOUTS, ctl->remotename, ctl->server.truename); @@ -1500,7 +1504,8 @@ const struct method *proto; /* protocol method table */ /* execute pre-initialization command, if any */ if (ctl->preconnect && (ok = system(ctl->preconnect))) { - report(stderr, 0, _("pre-connection command failed with status %d"), ok); + report(stderr, 0, + _("pre-connection command failed with status %d\n"), ok); ok = PS_SYNTAX; goto closeUp; } @@ -1525,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")); + report(stderr, 0, _("fetchmail: internal inconsistency\n")); #endif /* * Avoid generating a bogus error every poll cycle when we're @@ -1535,26 +1540,26 @@ 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"), + report_build(stderr, _("fetchmail: %s connection to %s failed\n"), 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")); + report_complete(stderr, 0, _(": host is unknown\n")); else if (h_errno == NO_ADDRESS) - report_complete(stderr, 0, _(": name is valid but has no IP address")); + report_complete(stderr, 0, _(": name is valid but has no IP address\n")); else if (h_errno == NO_RECOVERY) - report_complete(stderr, 0, _(": unrecoverable name server error")); + report_complete(stderr, 0, _(": unrecoverable name server error\n")); else if (h_errno == TRY_AGAIN) - report_complete(stderr, 0, _(": temporary name server error")); + report_complete(stderr, 0, _(": temporary name server error\n")); else - report_complete(stderr, 0, _(": unknown DNS error %d"), h_errno); + report_complete(stderr, 0, _(": unknown DNS error %d\n"), h_errno); } else #endif /* HAVE_RES_SEARCH */ - report_complete(stderr, err_no, ""); + report_complete(stderr, err_no, "\n"); ehostunreach: #endif /* INET6 */ @@ -1605,14 +1610,14 @@ const struct method *proto; /* protocol method table */ if (ok != 0) { if (ok == PS_LOCKBUSY) - report(stderr, 0, _("Lock-busy error on %s@%s"), + report(stderr, 0, _("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"), + report(stderr, 0, _("Authorization failure on %s@%s\n"), ctl->remotename, ctl->server.truename); @@ -1628,7 +1633,7 @@ const struct method *proto; /* protocol method table */ stuff_warning(ctl, _("Subject: fetchmail authentication failed\r\n")); stuff_warning(ctl, - _("Fetchmail could not get mail from %s@%s."), + _("Fetchmail could not get mail from %s@%s.\n"), ctl->remotename, ctl->server.truename); stuff_warning(ctl, @@ -1655,9 +1660,9 @@ const struct method *proto; /* protocol method table */ if (outlevel >= O_DEBUG) if (idp->id) - report(stdout, 0, _("selecting or re-polling folder %s"), idp->id); + report(stdout, 0, _("selecting or re-polling folder %s\n"), idp->id); else - report(stdout, 0, _("selecting or re-polling default folder")); + report(stdout, 0, _("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); @@ -1673,7 +1678,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"), ctl->server.truename); + report(stdout, 0, _("Polling %s\n"), ctl->server.truename); else if (count != 0) { if (new != -1 && (count - new) > 0) @@ -1686,15 +1691,15 @@ const struct method *proto; /* protocol method table */ count, count > 1 ? _("messages") : _("message"), buf); if (bytes == -1) - report_complete(stdout, 0, "."); + report_complete(stdout, 0, ".\n"); else - report_complete(stdout, 0, _(" (%d octets)."), bytes); + report_complete(stdout, 0, _(" (%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"), buf); + report(stdout, 0, _("No mail for %s\n"), buf); } /* very important, this is where we leave the do loop */ @@ -1880,9 +1885,9 @@ const struct method *proto; /* protocol method table */ report_build(stdout, _(" (%d %soctets)"), len, wholesize ? "" : _("header ")); if (outlevel >= O_VERBOSE) - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); else - report_build(stdout, " "); + report_complete(stdout, 0, " "); } /* @@ -1913,7 +1918,10 @@ const struct method *proto; /* protocol method table */ if (protocol->fetch_body && !suppress_readbody) { if (outlevel >= O_VERBOSE) - fputc('\n', stderr); + { + fputc('\n', stdout); + fflush(stdout); + } if ((ok = (protocol->trail)(sock, ctl, num))) goto cleanUp; @@ -1923,7 +1931,8 @@ const struct method *proto; /* protocol method table */ if ((ok=(protocol->fetch_body)(sock,ctl,num,&len))) goto cleanUp; if (outlevel > O_SILENT && !wholesize) - report_build(stdout, _(" (%d body octets) "), len); + report_complete(stdout, 0, + _(" (%d body octets) "), len); } } @@ -1954,7 +1963,10 @@ const struct method *proto; /* protocol method table */ if (protocol->trail) { if (outlevel >= O_VERBOSE) - fputc('\n', stderr); + { + fputc('\n', stdout); + fflush(stdout); + } ok = (protocol->trail)(sock, ctl, num); if (ok != 0) @@ -1992,7 +2004,7 @@ const struct method *proto; /* protocol method table */ { if (outlevel >= O_DEBUG) report(stdout, 0, - _("message %d was not the expected length (%d actual != %d expected)"), + _("message %d was not the expected length (%d actual != %d expected)\n"), num, msglen, msgsizes[num-1]); } @@ -2030,7 +2042,7 @@ const struct method *proto; /* protocol method table */ if (retained) { if (outlevel > O_SILENT) - report_complete(stdout, 0, _(" retained")); + report(stdout, 0, _(" retained\n")); } else if (protocol->delete && !suppress_delete @@ -2038,7 +2050,7 @@ const struct method *proto; /* protocol method table */ { deletions++; if (outlevel > O_SILENT) - report_complete(stdout, 0, _(" flushed")); + report_complete(stdout, 0, _(" flushed\n")); ok = (protocol->delete)(sock, ctl, num); if (ok != 0) goto cleanUp; @@ -2047,13 +2059,13 @@ const struct method *proto; /* protocol method table */ #endif /* POP3_ENABLE */ } else if (outlevel > O_SILENT) - report_complete(stdout, 0, _(" not flushed")); + report_complete(stdout, 0, _(" 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"), + report(stdout, 0, _("fetchlimit reached; %d messages left on server\n"), count - fetches); goto no_error; } @@ -2125,19 +2137,19 @@ const struct method *proto; /* protocol method table */ msg = _("DNS lookup"); break; case PS_UNDEFINED: - report(stderr, 0, _("undefined")); + report(stderr, 0, _("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"), msg, ctl->server.pollname); + report(stderr,0, _("%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"), ok); + report(stderr, 0, _("post-connection command failed with status %d\n"), ok); if (ok == PS_SUCCESS) ok = PS_SYNTAX; } @@ -2194,7 +2206,7 @@ va_dcl *cp = '\0'; } buf[strlen(buf)-2] = '\0'; - report(stdout, 0, "%s> %s", protocol->name, buf); + report(stdout, 0, "%s> %s\n", protocol->name, buf); } } @@ -2222,7 +2234,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", protocol->name, buf); + report(stdout, 0, "%s< %s\n", protocol->name, buf); phase = oldphase; return(PS_SUCCESS); } @@ -2280,7 +2292,7 @@ va_dcl *cp = '\0'; } buf[strlen(buf)-1] = '\0'; - report(stdout, 0, "%s> %s", protocol->name, buf); + report(stdout, 0, "%s> %s\n", protocol->name, buf); } /* we presume this does its own response echoing */ @@ -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"), + report(stderr, 0, _("%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"), + report(stderr, 0, _("%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"), qnp->id); + report(stdout, 0, _("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"), qnp->id); + report(stdout, 0, _("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"), qnp->id); + report(stdout, 0, _("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"),qnp->id); + report(stderr, 0, _("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"), qnp->id, buf); + report(stderr, 0, _("Node %s not allowed: %s\n"), qnp->id, buf); return(PS_AUTHFAIL); case 500: /* Syntax Error */ - report(stderr, 0, _("ETRN syntax error")); + report(stderr, 0, _("ETRN syntax error\n")); return(PS_PROTOCOL); case 501: /* Syntax Error in Parameters */ - report(stderr, 0, _("ETRN syntax error in parameters")); + report(stderr, 0, _("ETRN syntax error in parameters\n")); return(PS_PROTOCOL); default: - report(stderr, 0, _("Unknown ETRN error %d"), atoi(buf)); + report(stderr, 0, _("Unknown ETRN error %d\n"), atoi(buf)); return(PS_PROTOCOL); } } diff --git a/fetchmail.c b/fetchmail.c index d2c31744..68ab7fdd 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -164,9 +164,6 @@ int main (int argc, char **argv) if ((parsestatus = parsecmdline(argc,argv, &cmd_run, &cmd_opts)) < 0) exit(PS_SYNTAX); - /* this hint to stdio should help messages come out in the right order */ - setvbuf(stdout, NULL, _IOLBF, MSGBUFSIZE); - if (versioninfo) { printf(_("This is fetchmail release %s"), VERSION); @@ -467,7 +464,7 @@ int main (int argc, char **argv) { if (!nodetach) daemonize(run.logfile, termhook); - report(stdout, 0, _("starting fetchmail %s daemon "), VERSION); + report(stdout, 0, _("starting fetchmail %s daemon \n"), VERSION); /* * We'll set up a handler for these when we're sleeping, @@ -533,7 +530,7 @@ int main (int argc, char **argv) if (ctl->wedged) { report(stderr, 0, - _("poll of %s skipped (failed authentication or too many timeouts)"), + _("poll of %s skipped (failed authentication or too many timeouts)\n"), ctl->server.pollname); continue; } @@ -545,7 +542,7 @@ int main (int argc, char **argv) { if (outlevel >= O_VERBOSE) report(stdout, 0, - _("interval not reached, not querying %s"), + _("interval not reached, not querying %s\n"), ctl->server.pollname); continue; } @@ -572,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")); + report(stdout, 0, _("saved UID List\n")); } #endif /* POP3_ENABLE */ } else if (!check_only && ((querystatus!=PS_NOMAIL) || (outlevel==O_DEBUG))) - report(stdout, 0, _("Query status=%d"), querystatus); + report(stdout, 0, _("Query status=%d\n"), querystatus); #if defined(linux) && !INET6 if (ctl->server.monitor) @@ -635,12 +632,13 @@ int main (int argc, char **argv) unwedged++; if (!unwedged) { - report(stderr, 0, _("All connections are wedged. Exiting.")); + report(stderr, 0, _("All connections are wedged. Exiting.\n")); exit(PS_AUTHFAIL); } if (outlevel >= O_VERBOSE) - report(stdout, 0, _("fetchmail: sleeping at %s"), rfc822timestamp()); + report(stdout, 0, + _("fetchmail: sleeping at %s\n"), rfc822timestamp()); /* * With this simple hack, we make it possible for a foreground @@ -735,9 +733,11 @@ int main (int argc, char **argv) || ((run.poll_interval && !getuid()) && lastsig == SIGHUP)) { #ifdef SYS_SIGLIST_DECLARED - report(stdout, 0, _("awakened by %s"), sys_siglist[lastsig]); + report(stdout, 0, + _("awakened by %s\n"), sys_siglist[lastsig]); #else - report(stdout, 0, _("awakened by signal %d"), lastsig); + report(stdout, 0, + _("awakened by signal %d\n"), lastsig); #endif /* received a wakeup - unwedge all servers in case */ /* the problem has been manually repaired */ @@ -752,13 +752,13 @@ int main (int argc, char **argv) signal(SIGHUP, SIG_IGN); if (outlevel >= O_VERBOSE) - report(stdout, 0, _("awakened at %s"), rfc822timestamp()); + report(stdout, 0, _("awakened at %s\n"), rfc822timestamp()); } } while (run.poll_interval); if (outlevel >= O_VERBOSE) - report(stdout, 0, _("normal termination, status %d"), + report(stdout, 0, _("normal termination, status %d\n"), successes ? PS_SUCCESS : querystatus); termhook(0); @@ -1032,8 +1032,9 @@ 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, _("couldn't find HESIOD pobox for %s"), - ctl->remotename); + report(stderr, errno, + _("couldn't find HESIOD pobox for %s\n"), + ctl->remotename); } } #endif /* HESIOD */ @@ -1058,7 +1059,7 @@ static int load_params(int argc, char **argv, int optind) if (namerec == (struct hostent *)NULL) { report(stderr, errno, - _("couldn't find canonical DNS name of %s"), + _("couldn't find canonical DNS name of %s\n"), ctl->server.pollname); exit(PS_DNS); } @@ -1174,7 +1175,7 @@ static void termhook(int sig) */ if (sig != 0) - report(stdout, 0, _("terminated with signal %d"), sig); + report(stdout, 0, _("terminated with signal %d\n"), sig); else /* terminate all SMTP connections cleanly */ for (ctl = querylist; ctl; ctl = ctl->next) @@ -1234,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"), + report(stdout, 0, _("%s querying %s (protocol %s) at %s\n"), VERSION, ctl->server.pollname, showproto(ctl->server.protocol), ctime(&now)); } @@ -1292,7 +1293,7 @@ static int query_host(struct query *ctl) #endif /* HAVE_GETHOSTBYNAME */ #endif /* ETRN_ENABLE */ default: - report(stderr, 0, _("unsupported protocol selected.")); + report(stderr, 0, _("unsupported protocol selected.\n")); return(PS_PROTOCOL); } } @@ -190,7 +190,7 @@ static void restore_tty_state(void) static RETSIGTYPE sigint_handler(int signum) { restore_tty_state(); - report(stderr, 1, 0, _("\nCaught signal... bailing out.")); + report(stderr, 1, 0, _("\nCaught signal... bailing out.\n")); } /* getpass.c ends here */ @@ -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")); + report(stderr, 0, _("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", buffer); + report(stdout, 0, "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")); + report(stderr, 0, _("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", buffer); + report(stdout, 0, "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")); + report(stderr, 0, _("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", krb_get_err_text(result)); + report(stderr, 0, "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", krb_get_err_text(result)); + report(stderr, 0, "krb_get_cred: %s\n", krb_get_err_text(result)); return PS_AUTHFAIL; } @@ -286,18 +286,20 @@ 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", krb_get_err_text(result)); + report(stderr, 0, "krb_get_tf_fullname: %s\n", krb_get_err_text(result)); return PS_AUTHFAIL; } if (strcmp(tktuser, user) != 0) { - report(stderr, 0, _("principal %s in ticket does not match -u %s"), tktuser, + report(stderr, 0, + _("principal %s in ticket does not match -u %s\n"), tktuser, user); return PS_AUTHFAIL; } if (tktinst[0]) { - report(stderr, 0, _("non-null instance (%s) might cause strange behavior"), + report(stderr, 0, + _("non-null instance (%s) might cause strange behavior\n"), tktinst); strcat(tktuser, "."); strcat(tktuser, tktinst); @@ -311,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", krb_get_err_text(result)); + report(stderr, 0, "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", buf1); + report(stdout, 0, "IMAP> %s\n", buf1); } SockWrite(sock, buf1, strlen(buf1)); SockWrite(sock, "\r\n", 2); @@ -363,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")); + report(stderr, 0, _("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")); + report(stderr, 0, _("challenge mismatch\n")); return PS_AUTHFAIL; } @@ -400,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", buf1); + report(stdout, 0, "IMAP> %s\n", buf1); } SockWrite(sock, buf1, strlen(buf1)); SockWrite(sock, "\r\n", 2); @@ -443,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]"), buf1); + report(stderr, 0, _("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]"),request_buf.value); + report(stderr, 0, _("Using service name [%s]\n"),request_buf.value); maj_stat = gss_release_buffer(&min_stat, &request_buf); } @@ -465,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")); + report(stdout, 0, _("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")); + report(stderr, 0,_("Error exchanging credentials\n")); gss_release_name(&min_stat, &target_name); /* wake up server and await NO response */ SockWrite(sock, "\r\n", 2); @@ -484,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", buf1); + report(stdout, 0, "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); @@ -507,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")); + report(stderr, 0,_("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")); + report(stdout, 0, _("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")); + report(stderr, 0,_("Server requires integrity and/or privacy\n")); gss_release_buffer(&min_stat, &send_token); return PS_AUTHFAIL; } @@ -525,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"), + report(stdout, 0, _("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"),buf_size); + report(stdout, 0, _("Maximum GSS token size is %ld\n"),buf_size); } /* now respond in kind (hack!!!) */ @@ -542,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")); + report(stderr, 0,_("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"), username); - report(stdout, 0, "IMAP> %s",buf1); + report(stdout, 0, _("Requesting authorisation as %s\n"), username); + report(stdout, 0, "IMAP> %s\n",buf1); } SockWrite(sock, buf1, strlen(buf1)); SockWrite(sock, "\r\n", 2); @@ -559,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")); + report(stdout, 0, _("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")); + report(stderr, 0, _("Error releasing credentials\n")); return PS_AUTHFAIL; } /* send_token may contain a notification to the server to flush @@ -609,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")); + report(stdout, 0, _("Protocol identified as IMAP4 rev 1\n")); } else { imap_version = IMAP4; if (outlevel >= O_DEBUG) - report(stdout, 0, _("Protocol identified as IMAP4 rev 0")); + report(stdout, 0, _("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")); + report(stdout, 0, _("Protocol identified as IMAP2 or IMAP2BIS\n")); } else return(ok); @@ -633,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")); + report(stdout, 0, _("OTP authentication is supported\n")); if (do_otp(sock, ctl) == PS_SUCCESS) return(PS_SUCCESS); }; @@ -645,13 +647,14 @@ 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")); + report(stdout, 0, _("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, _("Required GSS capability not supported by server")); + report(stderr, 0, + _("Required GSS capability not supported by server\n")); return(PS_AUTHFAIL); } #endif /* GSSAPI */ @@ -660,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")); + report(stdout, 0, _("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> *"); + report(stdout, 0, "IMAP> *\n"); SockWrite(sock, "*\r\n", 3); } @@ -677,7 +680,8 @@ int imap_getauth(int sock, struct query *ctl, char *greeting) } else if (ctl->server.protocol == P_IMAP_K4) { - report(stderr, 0, _("Required KERBEROS_V4 capability not supported by server")); + report(stderr, 0, + _("Required KERBEROS_V4 capability not supported by server\n")); return(PS_AUTHFAIL); } #endif /* KERBEROS_V4 */ @@ -685,7 +689,8 @@ 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, _("Required LOGIN capability not supported by server")); + report(stderr, 0, + _("Required LOGIN capability not supported by server\n")); return PS_AUTHFAIL; }; #endif /* __UNUSED__ */ @@ -739,7 +744,7 @@ static int imap_getrange(int sock, count = -1; if (ok || gen_transact(sock, "NOOP")) { - report(stderr, 0, _("re-poll failed")); + report(stderr, 0, _("re-poll failed\n")); return(ok); } else if (count == -1) /* no EXISTS response to NOOP */ @@ -756,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")); + report(stderr, 0, _("mailbox selection failed\n")); return(ok); } } diff --git a/interface.c b/interface.c index eeff225c..419e7d01 100644 --- a/interface.c +++ b/interface.c @@ -193,7 +193,8 @@ void interface_parse(char *buf, struct hostdata *hp) /* find and isolate just the IP address */ if (!(cp1 = strchr(buf, '/'))) - (void) report(stderr, PS_SYNTAX, _("missing IP interface address")); + (void) report(stderr, PS_SYNTAX, + _("missing IP interface address\n")); *cp1++ = '\000'; /* find and isolate just the netmask */ @@ -205,9 +206,11 @@ 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, _("invalid IP interface address")); + (void) report(stderr, PS_SYNTAX, + _("invalid IP interface address\n")); if (!inet_aton(cp2, &hp->interface_pair->interface_mask)) - (void) report(stderr, PS_SYNTAX, _("invalid IP interface mask")); + (void) report(stderr, PS_SYNTAX, + _("invalid IP interface mask\n")); /* apply the mask now to the IP address (range) required */ hp->interface_pair->interface_address.s_addr &= hp->interface_pair->interface_mask.s_addr; @@ -243,8 +246,9 @@ void interface_note_activity(struct hostdata *hp) } #ifdef ACTIVITY_DEBUG - (void) report(stdout, 0, _("activity on %s -noted- as %d"), - hp->monitor, hp->monitor_io); + (void) report(stdout, 0, + _("activity on %s -noted- as %d\n"), + hp->monitor, hp->monitor_io); #endif } @@ -257,8 +261,9 @@ int interface_approve(struct hostdata *hp) if (hp->interface) { /* get interface info */ if (!get_ifinfo(hp->interface, &ifinfo)) { - (void) report(stdout, 0, _("skipping poll of %s, %s down"), - hp->pollname, hp->interface); + (void) report(stdout, 0, + _("skipping poll of %s, %s down\n"), + hp->pollname, hp->interface); return(FALSE); } /* check the IP address (range) */ @@ -266,7 +271,7 @@ int interface_approve(struct hostdata *hp) hp->interface_pair->interface_mask.s_addr) != hp->interface_pair->interface_address.s_addr) { (void) report(stdout, 0, - _("skipping poll of %s, %s IP address excluded"), + _("skipping poll of %s, %s IP address excluded\n"), hp->pollname, hp->interface); return(FALSE); } @@ -277,15 +282,17 @@ int interface_approve(struct hostdata *hp) return(TRUE); #ifdef ACTIVITY_DEBUG - (void) report(stdout, 0, _("activity on %s checked as %d"), - hp->monitor, hp->monitor_io); + (void) report(stdout, 0, + _("activity on %s checked as %d\n"), + hp->monitor, hp->monitor_io); #endif /* if monitoring, check link for activity if it is up */ if (get_ifinfo(hp->monitor, &ifinfo) && hp->monitor_io == ifinfo.rx_packets + ifinfo.tx_packets) { - (void) report(stdout, 0, _("skipping poll of %s, %s inactive"), - hp->pollname, hp->monitor); + (void) report(stdout, 0, + _("skipping poll of %s, %s inactive\n"), + hp->pollname, hp->monitor); return(FALSE); } @@ -92,7 +92,7 @@ int pop3_ok (int sock, char *argbuf) else ok = PS_AUTHFAIL; if (*bufp) - report(stderr, 0, bufp); + report(stderr, 0, "%s\n", bufp); } else ok = PS_PROTOCOL; @@ -199,7 +199,8 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) for (start = greeting; *start != 0 && *start != '<'; start++) continue; if (*start == 0) { - report(stderr, 0, _("Required APOP timestamp not found in greeting")); + report(stderr, 0, + _("Required APOP timestamp not found in greeting\n")); return(PS_AUTHFAIL); } @@ -207,7 +208,8 @@ 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, _("Timestamp syntax error in greeting")); + report(stderr, 0, + _("Timestamp syntax error in greeting\n")); return(PS_AUTHFAIL); } else @@ -229,7 +231,7 @@ int pop3_getauth(int sock, struct query *ctl, char *greeting) break; default: - report(stderr, 0, _("Undefined protocol request in POP3_auth")); + report(stderr, 0, _("Undefined protocol request in POP3_auth\n")); ok = PS_ERROR; } @@ -237,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?")); + report(stderr, 0, _("lock busy! Is another session active?\n")); return(ok); } @@ -346,7 +348,7 @@ pop3_slowuidl( int sock, struct query *ctl, int *countp, int *newp) } } else { report(stderr, 0, - _("Messages inserted into list on server. Cannot handle this.")); + _("Messages inserted into list on server. Cannot handle this.\n")); return -1; } } @@ -419,7 +421,7 @@ static int pop3_getrange(int sock, { if (sscanf(buf, "%d", &last) == 0) { - report(stderr, 0, _("protocol error")); + report(stderr, 0, _("protocol error\n")); return(PS_ERROR); } *newp = (*countp - last); @@ -432,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")); + report(stderr, 0, _("protocol error while fetching UIDLs\n")); return(PS_ERROR); } } @@ -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", pathname); + report(stderr, errno, "lstat: %s\n", pathname); 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", pathname); + report(stderr, errno, "open: %s\n", pathname); return(PS_IOERR); } @@ -225,7 +225,6 @@ report (FILE *errfp, errnum, message, va_alist) fprintf (errfp, _(": Error %d"), errnum); } } - putc ('\n', errfp); fflush (errfp); } ++error_message_count; @@ -468,7 +467,6 @@ report_complete (FILE *errfp, errnum, message, va_alist) if (errnum) fprintf (errfp, ": %s", strerror (errnum)); - putc ('\n', errfp); fflush (errfp); ++error_message_count; @@ -178,7 +178,7 @@ const char *host; /* server hostname */ #ifndef TESTMAIN if (outlevel >= O_DEBUG) - report_complete(stdout, 0, "Rewritten version is %s", buf); + report_complete(stdout, 0, "Rewritten version is %s\n", buf); #endif /* TESTMAIN */ return(buf); } @@ -183,10 +183,10 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) bufp += Csl; if (outlevel >= O_DEBUG) { - report(stdout, 0, _("Service challenge (l=%d):"),Csl); + report(stdout, 0, _("Service challenge (l=%d):\n"),Csl); for (i=0; i<Csl; i++) report_build(stdout, "%02X ",Cs[i]); - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } memcpy(Ts, bufp, Tsl); Ts[Tsl] = 0; @@ -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):"),aulin); + report(stdout, 0, _("User authentication (l=%d):\n"),aulin); for (i=0; i<aulin; i++) report_build(stdout, "%02X ",bufp[i]); - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } if (aulin == Aul) memcpy(Au, bufp, Aul); bufp += aulin; @@ -287,7 +287,8 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) } if (Aul != aulin) { - report(stderr, 0, _("RPA User Authentication length error: %d\n"),aulin); + report(stderr, 0, + _("RPA User Authentication length error: %d\n"),aulin); return(PS_RPA); } if (Kusl != kuslin) @@ -303,10 +304,10 @@ int POP3_auth_rpa (unsigned char *userid, unsigned char *passphrase, int socket) } if (outlevel >= O_DEBUG) { - report(stdout, 0, _("Session key established:")); + report(stdout, 0, _("Session key established:\n")); for (i=0; i<Kusl; i++) report_build(stdout, "%02X ",Kus[i]); - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } /* Assemble Token 5 in buf and send (not in ver 2 though) */ @@ -455,7 +456,8 @@ int rxlen; save = *pptr; if (**pptr != HDR) { - if (outlevel > O_SILENT) report(stderr, 0, _("Hdr not 60\n")); + if (outlevel > O_SILENT) + report(stderr, 0, _("Hdr not 60\n")); return(0); } (*pptr)++; @@ -544,7 +546,7 @@ unsigned char *bufp; { report_build(stdout, "%02X ",bufp[i]); if (((i % 16)==15) || (i==(cnt-1))) - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } } return(cnt); @@ -582,7 +584,7 @@ int len; { report_build(stdout, "%02X ",bufp[i]); if (((i % 16)==15) || (i==(len-1))) - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } } outp = bufp + (((len-1)/3)*4); @@ -648,12 +650,12 @@ int conv; } if (outlevel >= O_DEBUG) { - report(stdout, 0, _("Unicode:")); + report(stdout, 0, _("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, ""); + report_complete(stdout, 0, "\n"); } } } @@ -725,12 +727,12 @@ int len; if (outlevel >= O_DEBUG) { - report(stdout, 0, _("User challenge:")); + report(stdout, 0, _("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, ""); + report_complete(stdout, 0, "\n"); } } } @@ -888,7 +890,7 @@ unsigned char* out; { report_build(stdout, "%02X ",in[i]); if (((i % 16)==15) || (i==(len-1))) - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } } MD5Init( &md5context ); @@ -896,12 +898,12 @@ unsigned char* out; MD5Final( out, &md5context ); if (outlevel >= O_DEBUG) { - report(stdout, 0, _("MD5 result is: ")); + report(stdout, 0, _("MD5 result is: \n")); for (i=0; i<16; i++) { report_build(stdout, "%02X ",out[i]); } - report_complete(stdout, 0, ""); + report_complete(stdout, 0, "\n"); } } #endif /* POP3_ENABLE && RPA_ENABLE */ @@ -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"), ctl->smtphost); + report(stdout, 0, _("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)"); + report(stdout, 0, "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"), + report(stderr, 0, _("%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")); + report(stderr, 0, _("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"), before); + report(stdout, 0, _("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")); + report(stderr, 0, _("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"), + report(stderr, errno, _("%cMTP connect to %s failed\n"), ctl->listener, ctl->smtphost ? ctl->smtphost : "localhost"); return(PS_SMTP); @@ -756,7 +756,7 @@ int open_sink(struct query *ctl, struct msgblk *msg, idp->val.status.mark = XMIT_RCPTBAD; if (outlevel >= O_VERBOSE) report(stderr, 0, - _("%cMTP listener doesn't like recipient address `%s'"), + _("%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!"), run.postmaster); + report(stderr, 0, _("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."), run.postmaster); + report(stderr, 0, _("no address matches; forwarding to %s.\n"), run.postmaster); } /* @@ -846,7 +846,8 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) signal(SIGCHLD, sigchld); if (rc) { - report(stderr, 0, _("MDA exited abnormally or returned nonzero status")); + report(stderr, 0, + _("MDA exited abnormally or returned nonzero status\n")); return(FALSE); } } @@ -858,7 +859,8 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) fclose(sinkfp); if (ferror(sinkfp)) { - report(stderr, 0, _("Message termination or close of BSMTP file failed")); + report(stderr, 0, + _("Message termination or close of BSMTP file failed\n")); return(FALSE); } } @@ -871,7 +873,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) return(FALSE); else { - report(stderr, 0, _("SMTP listener refused delivery")); + report(stderr, 0, _("SMTP listener refused delivery\n")); return(TRUE); } } @@ -899,10 +901,10 @@ 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")); + report(stderr, 0, _("LMTP delivery error on EOM\n")); else report(stderr, 0, - _("Unexpected non-503 response to LMTP EOM: %s"), + _("Unexpected non-503 response to LMTP EOM: %s\n"), smtp_response); /* @@ -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", host); + report(stdout, 0, "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", + report(stdout, 0, "%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", smtp_response); + report(stdout, 0, "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", smtp_mode, buf); + report(stdout, 0, "%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>", smtp_mode, to); + report(stdout, 0, "%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", smtp_mode); + report(stdout, 0, "%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", smtp_mode); + report(stdout, 0, "%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", smtp_mode); + report(stdout, 0, "%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)", smtp_mode); + report(stdout, 0, "%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", smtp_mode, smtp_response); + report(stdout, 0, "%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] != '-') @@ -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")); + report(stderr, errno, _("fetchmail: socketpair failed\n")); return -1; } switch (fork()) { case -1: /* error */ - report(stderr, errno, _("fetchmail: fork failed")); + report(stderr, errno, _("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")); + report(stderr, errno, _("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"), plugin, host, service); + report(stderr, 0, _("running %s %s %s\n"), plugin, host, service); execlp(plugin,plugin,host,service,0); - report(stderr, errno, _("execl(%s) failed"), plugin); + report(stderr, errno, _("execl(%s) failed\n"), plugin); exit(0); break; default: /* parent */ @@ -106,7 +106,7 @@ int SockOpen(const char *host, const char *service, const char *options, req.ai_socktype = SOCK_STREAM; if (i = getaddrinfo(host, service, &req, &ai)) { - report(stderr, i, _("fetchmail: getaddrinfo(%s.%s)"), host,service); + report(stderr, i, _("fetchmail: getaddrinfo(%s.%s)\n"), host,service); return -1; }; @@ -186,7 +186,8 @@ 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, _("fetchmail: illegal address length received for host %s"),host); + report(stderr, 0, + _("fetchmail: illegal address length received for host %s\n"),host); return -1; } /* @@ -40,7 +40,7 @@ int n; p = (XALLOCATYPE *) alloca(n); if (p == (XALLOCATYPE *) 0) - report(stderr, PS_UNDEFINED, 0, "alloca failed"); + report(stderr, PS_UNDEFINED, 0, "alloca failed\n"); return(p); } @@ -29,7 +29,7 @@ xmalloc (int n) p = (XMALLOCTYPE *) malloc(n); if (p == (XMALLOCTYPE *) 0) { - report(stderr, errno, _("malloc failed")); + report(stderr, errno, _("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")); + report(stderr, errno, _("realloc failed\n")); exit(PS_UNDEFINED); } return p; |