* Fixed the spam-block code that I broke in 4.5.3 :-(.
* Updated the entry on setting up sendmail spam blocks.
* Added setrlimit call to inhibit core dumps unless debugging is on.
+* The default of smtplist has been changed; the undocumented feature that
+ it always included the fetchmail host's FQDN is gone (this is now
+ true for ETRN mode only).
+* Modes other than ETRN no longer need to know the fetchmail host's FQDN.
+ This eliminates a gethostbyname() call and makes fetchmail more independent
+ of local DNS configuration quirks.
There are 257 people on fetchmail-friends and 255 on fetchmail-announce.
* What it will affect is the listener's logging.
*/
struct idlist *idp;
- char *id_me = run.invisible ? ctl->server.truename : fetchmailhost;
+ char *id_me = run.invisible ? ctl->server.truename : "localhost";
int oldphase = phase;
errno = 0;
#else
sprintf(buf,
#endif /* HAVE_SNPRINTF */
- "From: <FETCHMAIL-DAEMON@%s>\r\nTo: %s@localhost\r\nSubject: Headerless mail from %s's mailbox on %s\r\n",
- fetchmailhost, user, ctl->remotename, ctl->server.truename);
+ "From: FETCHMAIL-DAEMON\r\nTo: %s@localhost\r\nSubject: Headerless mail from %s's mailbox on %s\r\n",
+ user, ctl->remotename, ctl->server.truename);
headers = xstrdup(buf);
}
* but this can be secure information that would be bad
* to reveal.
*/
- sprintf(buf, "\tby %s (fetchmail-%s %s)\n",
- fetchmailhost,
+ sprintf(buf, "\tby fetchmail-%s %s\n",
RELEASE_ID,
protocol->name);
n = stuffline(ctl, buf);
}
}
- /* we'll need this for the SMTP forwarding target and error messages */
- if (gethostname(tmpbuf, sizeof(tmpbuf)))
- {
- fprintf(stderr, "%s: can't determine your host!", program_name);
- exit(PS_IOERR);
- }
-#ifdef HAVE_GETHOSTBYNAME
- /* if we got a . in the hostname assume it is a FQDN */
- if (strchr(tmpbuf, '.') == NULL)
- {
- struct hostent *hp;
-
- /* in case we got a basename (as we do in Linux) make a FQDN of it */
- hp = gethostbyname(tmpbuf);
- if (hp == (struct hostent *) NULL)
- {
- /* exit with error message */
- fprintf(stderr, "gethostbyname failed for %s\n", tmpbuf);
- exit(PS_DNS);
- }
- fetchmailhost = xstrdup(hp->h_name);
- }
- else
-#endif /* HAVE_GETHOSTBYNAME */
- fetchmailhost = xstrdup(tmpbuf);
-
#define RCFILE_NAME ".fetchmailrc"
rcfile = (char *) xmalloc(strlen(home)+strlen(RCFILE_NAME)+2);
/* avoid //.fetchmailrc */
flag versioninfo; /* emit only version info */
char *user; /* the name of the invoking user */
char *home; /* invoking user's home directory */
-char *fetchmailhost; /* the name of the host running fetchmail */
char *program_name; /* the name to prefix error messages with */
flag configdump; /* dump control blocks for configurator */
/* make sure we have a nonempty host list to forward to */
if (!ctl->smtphunt)
{
- save_str(&ctl->smtphunt, fetchmailhost, FALSE);
- /* for non ETRN try to deliver mails to localhost if
- * fetchmailhost fails
+ char tmpbuf[HOSTLEN+1];
+ /*
+ * If we're using ETRN, the smtp hunt list is the list of
+ * systems we're polling on behalf of; these have to be
+ * fully-qualified domain names. The default for this list
+ * should be the FQDN of localhost.
*/
- if (ctl->server.protocol != P_ETRN) {
- save_str(&ctl->smtphunt, "localhost", FALSE);
+ if (ctl->server.protocol == P_ETRN)
+ {
+ char *fetchmailhost;
+
+ if (gethostname(tmpbuf, sizeof(tmpbuf)))
+ {
+ fprintf(stderr, "%s: can't determine your host!",
+ program_name);
+ exit(PS_DNS);
+ }
+#ifdef HAVE_GETHOSTBYNAME
+ /* if we got a . in the hostname assume it is a FQDN */
+ if (strchr(tmpbuf, '.') == NULL)
+ {
+ struct hostent *hp;
+
+ /* if we got a basename (as we do in Linux) make a FQDN of it */
+ hp = gethostbyname(tmpbuf);
+ if (hp == (struct hostent *) NULL)
+ {
+ /* exit with error message */
+ fprintf(stderr,
+ "gethostbyname failed for %s\n", tmpbuf);
+ exit(PS_DNS);
+ }
+ fetchmailhost = xstrdup(hp->h_name);
+ }
+ else
+#endif /* HAVE_GETHOSTBYNAME */
+ fetchmailhost = xstrdup(tmpbuf);
+
+ save_str(&ctl->smtphunt, fetchmailhost, FALSE);
}
+ else
+ save_str(&ctl->smtphunt, "localhost", FALSE);
}
/* keep lusers from shooting themselves in the foot :-) */
extern flag versioninfo; /* emit only version info */
extern char *user; /* name of invoking user */
extern char *home; /* home directory of invoking user */
-extern char *fetchmailhost; /* the name of the host running fetchmail */
extern int pass; /* number of re-polling pass */
extern flag configdump; /* dump control blocks as Python dictionary */
hostnames, comma-separated). In ETRN mode, set the host that the
mailserver is asked to ship mail to. Hosts are tried in list order;
the first one that is up becomes the forwarding or ETRN target for the
-current run. In all modes except ETRN, `localhost' is added to the
-end of the list as an invisible default. Each hostname may have a
-'/'-delimited suffix specifying a port or service to forward to; the
-default is 25 (or "smtp" under IPv6).
+current run. In ETRN mode, the FQDN of the machine running fetchmail
+is added to the end of the list as an invisible default; in all other
+modes `localhost' is added to the end of the list as an invisible
+default. Each hostname may have a '/'-delimited suffix specifying a
+port or service to forward to; the default is 25 (or "smtp" under IPv6).
.TP
.B \-D domain, --smtpaddress domain
(Keyword: smtpaddress)