2 * fetchmail.c -- main driver module for fetchmail
4 * For license terms, see the file COPYING in this directory.
10 #if defined(STDC_HEADERS)
13 #if defined(HAVE_UNISTD_H)
18 #if defined(HAVE_SYSLOG)
24 #include <sys/types.h>
27 #include <sys/resource.h>
28 #endif /* HAVE_SETRLIMIT */
29 #ifdef HAVE_SYS_WAIT_H
33 #ifdef HAVE_GETHOSTBYNAME
35 #endif /* HAVE_GETHOSTBYNAME */
41 #include "fetchmail.h"
49 #define ENETUNREACH 128 /* Interactive doesn't know this */
50 #endif /* ENETUNREACH */
52 /* prototypes for internal functions */
53 static int load_params(int, char **, int);
54 static void dump_params (struct runctl *runp, struct query *, flag implicit);
55 static int query_host(struct query *);
57 /* controls the detail level of status/progress messages written to stderr */
58 int outlevel; /* see the O_.* constants above */
60 /* miscellaneous global controls */
61 struct runctl run; /* global controls for this run */
62 flag nodetach; /* if TRUE, don't detach daemon process */
63 flag quitmode; /* if --quit was set */
64 flag check_only; /* if --probe was set */
65 flag versioninfo; /* emit only version info */
66 char *user; /* the name of the invoking user */
67 char *home; /* invoking user's home directory */
68 char *program_name; /* the name to prefix error messages with */
69 flag configdump; /* dump control blocks for configurator */
70 const char *fetchmailhost; /* either `localhost' or the host's FQDN */
75 #endif /* NET_SECURITY */
77 static char *lockfile; /* name of lockfile */
78 static int querystatus; /* status of query */
79 static int successes; /* count number of successful polls */
80 static int lastsig; /* last signal received */
81 static struct runctl cmd_run; /* global options set from command line */
83 static void termhook(int); /* forward declaration of exit hook */
86 #define SLEEP_WITH_ALARM
89 #ifdef SLEEP_WITH_ALARM
91 * The function of this variable is to remove the window during which a
92 * SIGALRM can hose the code (ALARM is triggered *before* pause() is called).
93 * This is a bit of a kluge; the real right thing would use sigprocmask(),
95 * This work around lets the interval timer trigger the first alarm after the
96 * required interval and will then generate alarms all 5 seconds, until it
97 * is certain, that the critical section (ie., the window) is left.
99 #if defined(STDC_HEADERS)
100 static sig_atomic_t alarm_latch = FALSE;
102 /* assume int can be written in one atomic operation on non ANSI-C systems */
103 static int alarm_latch = FALSE;
106 RETSIGTYPE gotsigalrm(sig)
109 signal(sig, gotsigalrm);
113 #endif /* SLEEP_WITH_ALARM */
115 RETSIGTYPE donothing(int sig) {signal(sig, donothing); lastsig = sig;}
118 static void unlockit(int n, void *p)
120 static void unlockit(void)
122 /* must-do actions for exit (but we can't count on being able to do malloc) */
128 /* Various EMX-specific definitions */
130 void itimerthread(void* dummy) {
131 if (outlevel >= O_VERBOSE)
132 fprintf(stderr, _("fetchmail: thread sleeping for %d sec.\n"), poll_interval);
134 _sleep2(poll_interval*1000);
135 kill((getpid()), SIGALRM);
140 int main (int argc, char **argv)
142 int st, bkgd = FALSE;
143 int parsestatus, implicitmode = FALSE;
146 netrc_entry *netrc_list;
147 char *netrc_file, *tmpbuf;
150 envquery(argc, argv);
152 bindtextdomain(PACKAGE, LOCALEDIR);
156 #define IDFILE_NAME ".fetchids"
157 run.idfile = (char *) xmalloc(strlen(home)+strlen(IDFILE_NAME)+2);
158 strcpy(run.idfile, home);
159 strcat(run.idfile, "/");
160 strcat(run.idfile, IDFILE_NAME);
164 if ((parsestatus = parsecmdline(argc,argv, &cmd_run, &cmd_opts)) < 0)
167 /* this hint to stdio should help messages come out in the right order */
168 setvbuf(stdout, NULL, _IOLBF, MSGBUFSIZE);
172 printf(_("This is fetchmail release %s"), VERSION);
175 #endif /* POP2_ENABLE */
178 #endif /* POP3_ENABLE */
181 #endif /* IMAP_ENABLE */
187 #endif /* RPA_ENABLE */
190 #endif /* SDPS_ENABLE */
193 #endif /* ETRN_ENABLE */
202 #endif /* NET_SECURITY */
207 #endif /* HAVE_SOCKS */
210 #endif /* ENABLE_NLS */
213 /* this is an attempt to help remote debugging */
217 /* avoid parsing the config file if all we're doing is killing a daemon */
218 if (!(quitmode && argc == 2))
219 implicitmode = load_params(argc, argv, optind);
221 /* set up to do lock protocol */
222 #define FETCHMAIL_PIDFILE "fetchmail.pid"
224 xalloca(tmpbuf, char *,
225 strlen(PID_DIR) + strlen(FETCHMAIL_PIDFILE) + 2);
226 sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE);
228 xalloca(tmpbuf, char *, strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
229 strcpy(tmpbuf, home);
230 strcat(tmpbuf, "/.");
231 strcat(tmpbuf, FETCHMAIL_PIDFILE);
233 #undef FETCHMAIL_PIDFILE
235 /* perhaps we just want to check options? */
238 printf(_("Taking options from command line"));
239 if (access(rcfile, 0))
242 printf(_(" and %s\n"), rcfile);
243 if (outlevel >= O_VERBOSE)
244 printf(_("Lockfile at %s\n"), tmpbuf);
246 if (querylist == NULL)
247 (void) fprintf(stderr,
248 _("No mailservers set up -- perhaps %s is missing?\n"), rcfile);
250 dump_params(&run, querylist, implicitmode);
254 /* dump options as a Python dictionary, for configurator use */
257 dump_config(&run, querylist);
261 /* check for another fetchmail running concurrently */
263 if ((lockfile = (char *) malloc(strlen(tmpbuf) + 1)) == NULL)
265 fprintf(stderr,_("fetchmail: cannot allocate memory for lock name.\n"));
269 (void) strcpy(lockfile, tmpbuf);
270 if ((lockfp = fopen(lockfile, "r")) != NULL )
272 bkgd = (fscanf(lockfp,"%d %d", &pid, &st) == 2);
274 if (kill(pid, 0) == -1) {
275 fprintf(stderr,_("fetchmail: removing stale lockfile\n"));
283 /* if no mail servers listed and nothing in background, we're done */
284 if (!(quitmode && argc == 2) && pid == -1 && querylist == NULL) {
285 (void)fputs(_("fetchmail: no mailservers have been specified.\n"),stderr);
289 /* perhaps user asked us to kill the other fetchmail */
294 fprintf(stderr,_("fetchmail: no other fetchmail is running\n"));
298 else if (kill(pid, SIGTERM) < 0)
300 fprintf(stderr,_("fetchmail: error killing %s fetchmail at %d; bailing out.\n"),
301 bkgd ? _("background") : _("foreground"), pid);
306 fprintf(stderr,_("fetchmail: %s fetchmail at %d killed.\n"),
307 bkgd ? _("background") : _("foreground"), pid);
316 /* another fetchmail is running -- wake it up or die */
322 _("fetchmail: can't check mail while another fetchmail to same host is running.\n"));
325 else if (!implicitmode)
328 _("fetchmail: can't poll specified hosts with another fetchmail running at %d.\n"),
335 _("fetchmail: another foreground fetchmail is running at %d.\n"),
342 _("fetchmail: can't accept options while a background fetchmail is running.\n"));
345 else if (kill(pid, SIGUSR1) == 0)
348 _("fetchmail: background fetchmail at %d awakened.\n"),
355 * Should never happen -- possible only if a background fetchmail
356 * croaks after the first kill probe above but before the
357 * SIGUSR1/SIGHUP transmission.
360 _("fetchmail: elder sibling at %d died mysteriously.\n"),
362 return(PS_UNDEFINED);
366 /* parse the ~/.netrc file (if present) for future password lookups. */
367 xalloca(netrc_file, char *, strlen (home) + 8);
368 strcpy (netrc_file, home);
369 strcat (netrc_file, "/.netrc");
370 netrc_list = parse_netrc(netrc_file);
372 #ifdef HAVE_SETRLIMIT
374 * Before getting passwords, disable core dumps unless -v -d0 mode is on.
375 * Core dumps could otherwise contain passwords to be scavenged by a
378 if (outlevel < O_VERBOSE || run.poll_interval > 0)
380 struct rlimit corelimit;
381 corelimit.rlim_cur = 0;
382 corelimit.rlim_max = 0;
383 setrlimit(RLIMIT_CORE, &corelimit);
385 #endif /* HAVE_SETRLIMIT */
387 /* pick up interactively any passwords we need but don't have */
388 for (ctl = querylist; ctl; ctl = ctl->next)
390 if (ctl->active && !(implicitmode && ctl->server.skip)&&!ctl->password)
392 if (ctl->server.preauthenticate == A_KERBEROS_V4 ||
393 ctl->server.preauthenticate == A_KERBEROS_V5 ||
395 ctl->server.protocol == P_IMAP_GSS ||
397 ctl->server.protocol == P_IMAP_K4)
398 /* Server won't care what the password is, but there
399 must be some non-null string here. */
400 ctl->password = ctl->remotename;
405 /* look up the pollname and account in the .netrc file. */
406 p = search_netrc(netrc_list, ctl->server.pollname);
407 while (p && strcmp(p->account, ctl->remotename))
408 p = search_netrc(p->next, ctl->remotename);
409 /* if we find a matching entry with a password, use it */
410 if (p && p->password)
411 ctl->password = xstrdup(p->password);
413 /* otherwise try with "via" name if there is one */
414 else if (ctl->server.via)
416 p = search_netrc(netrc_list, ctl->server.via);
417 while (p && strcmp(p->account, ctl->remotename))
418 p = search_netrc(p->next, ctl->remotename);
419 if (p && p->password)
420 ctl->password = xstrdup(p->password);
424 if (ctl->server.protocol != P_ETRN && ctl->server.protocol != P_IMAP_K4
426 && ctl->server.protocol != P_IMAP_GSS
430 char* password_prompt = _("Enter password for %s@%s: ");
432 xalloca(tmpbuf, char *, strlen(password_prompt) +
433 strlen(ctl->remotename) +
434 strlen(ctl->server.pollname) + 1);
435 (void) sprintf(tmpbuf, password_prompt,
436 ctl->remotename, ctl->server.pollname);
437 ctl->password = xstrdup((char *)getpassword(tmpbuf));
442 /* Time to initiate the SOCKS library (this is not mandatory: it just
443 registers the correct application name for logging purpose. If you
444 have some problem, comment these lines). */
447 /* Mmmh... I don't like hardcoded application names,
448 but "fetchmail" is everywhere... */
449 SOCKSinit("fetchmail");
451 #endif /* HAVE_SOCKS */
454 * Maybe time to go to demon mode...
456 #if defined(HAVE_SYSLOG)
459 openlog(program_name, LOG_PID, LOG_MAIL);
464 report_init((run.poll_interval == 0 || nodetach) && !run.logfile);
466 if (run.poll_interval)
469 daemonize(run.logfile, termhook);
470 report(stdout, 0, _("starting fetchmail %s daemon "), VERSION);
473 * We'll set up a handler for these when we're sleeping,
474 * but ignore them otherwise so as not to interrupt a poll.
476 signal(SIGUSR1, SIG_IGN);
477 if (run.poll_interval && !getuid())
478 signal(SIGHUP, SIG_IGN);
481 /* beyond here we don't want more than one fetchmail running per user */
483 signal(SIGABRT, termhook);
484 signal(SIGINT, termhook);
485 signal(SIGTERM, termhook);
486 signal(SIGALRM, termhook);
487 signal(SIGPIPE, termhook);
488 signal(SIGQUIT, termhook);
490 /* here's the exclusion lock */
491 if ((lockfp = fopen(lockfile,"w")) != NULL) {
492 fprintf(lockfp,"%d",getpid());
493 if (run.poll_interval)
494 fprintf(lockfp," %d", run.poll_interval);
501 on_exit(unlockit, (char *)NULL);
506 * Query all hosts. If there's only one, the error return will
507 * reflect the status of that transaction.
510 #if defined(HAVE_RES_SEARCH) && defined(USE_TCPIP_FOR_DNS)
512 * This was an efficiency hack that backfired. The theory
513 * was that using TCP/IP for DNS queries would get us better
514 * reliability and shave off some per-UDP-packet costs.
515 * Unfortunately it interacted badly with diald, which effectively
516 * filters out DNS queries over TCP/IP for reasons having to do
517 * with some obscure kernel problem involving bootstrapping of
518 * dynamically-addressed links. I don't understand this mess
519 * and don't want to, so it's "See ya!" to this hack.
521 sethostent(TRUE); /* use TCP/IP for mailserver queries */
522 #endif /* HAVE_RES_SEARCH */
525 for (ctl = querylist; ctl; ctl = ctl->next)
527 if (ctl->active && !(implicitmode && ctl->server.skip))
532 _("poll of %s skipped (failed authentication or too many timeouts)"),
533 ctl->server.pollname);
537 /* check skip interval first so that it counts all polls */
538 if (run.poll_interval && ctl->server.interval)
540 if (ctl->server.poll_count++ % ctl->server.interval)
542 if (outlevel >= O_VERBOSE)
544 _("interval not reached, not querying %s"),
545 ctl->server.pollname);
550 #if defined(linux) && !INET6
551 /* interface_approve() does its own error logging */
552 if (!interface_approve(&ctl->server))
554 #endif /* defined(linux) && !INET6 */
556 querystatus = query_host(ctl);
558 if (querystatus == PS_SUCCESS)
563 update_str_lists(ctl);
565 /* Save UID list to prevent re-fetch in case fetchmail
566 recover from crash */
569 write_saved_lists(querylist, run.idfile);
570 if (outlevel >= O_DEBUG)
571 report(stdout, 0, _("saved UID List"));
573 #endif /* POP3_ENABLE */
575 else if (!check_only &&
576 ((querystatus!=PS_NOMAIL) || (outlevel==O_DEBUG)))
577 report(stdout, 0, _("Query status=%d"), querystatus);
579 #if defined(linux) && !INET6
580 if (ctl->server.monitor)
583 * Allow some time for the link to quiesce. One
584 * second is usually sufficient, three is safe.
585 * Note: this delay is important - don't remove!
588 interface_note_activity(&ctl->server);
590 #endif /* defined(linux) && !INET6 */
594 #if defined(HAVE_RES_SEARCH) && defined(USE_TCPIP_FOR_DNS)
595 endhostent(); /* release TCP/IP connection to nameserver */
596 #endif /* HAVE_RES_SEARCH */
599 * Close all SMTP delivery sockets. For optimum performance
600 * we'd like to hold them open til end of run, but (1) this
601 * loses if our poll interval is longer than the MTA's inactivity
602 * timeout, and (2) some MTAs (like smail) don't deliver after
603 * each message, but rather queue up mail and wait to actually
604 * deliver it until the input socket is closed.
606 for (ctl = querylist; ctl; ctl = ctl->next)
607 if (ctl->smtp_socket != -1)
609 SMTP_quit(ctl->smtp_socket);
610 close(ctl->smtp_socket);
611 ctl->smtp_socket = -1;
615 * OK, we've polled. Now sleep.
617 if (run.poll_interval)
620 * Because passwords can expire, it may happen that *all*
621 * hosts are now out of the loop due to authfail
622 * conditions. If this happens daemon-mode fetchmail
623 * should softly and silently vanish away, rather than
624 * spinning uselessly.
628 for (ctl = querylist; ctl; ctl = ctl->next)
629 if (ctl->active && !(implicitmode && ctl->server.skip))
634 report(stderr, 0, _("All connections are wedged. Exiting."));
638 if (outlevel >= O_VERBOSE)
639 report(stdout, 0, _("fetchmail: sleeping at %s"), rfc822timestamp());
642 * With this simple hack, we make it possible for a foreground
643 * fetchmail to wake up one in daemon mode. What we want is the
644 * side effect of interrupting any sleep that may be going on,
645 * forcing fetchmail to re-poll its hosts. The second line is
646 * for people who think all system daemons wake up on SIGHUP.
648 signal(SIGUSR1, donothing);
650 signal(SIGHUP, donothing);
652 /* time for a pause in the action... */
655 #ifdef SLEEP_WITH_ALARM /* not normally on */
657 * We can't use sleep(3) here because we need an alarm(3)
658 * equivalent in order to implement server nonresponse timeout.
659 * We'll just assume setitimer(2) is available since fetchmail
660 * has to have a BSDoid socket layer to work at all.
663 * This code stopped working under glibc-2, apparently due
664 * to the change in signal(2) semantics. (The siginterrupt
665 * line, added later, should fix this problem.) John Stracke
666 * <francis@netscape.com> wrote:
668 * The problem seems to be that, after hitting the interval
669 * timer while talking to the server, the process no longer
670 * responds to SIGALRM. I put in printf()s to see when it
671 * reached the pause() for the poll interval, and I checked
672 * the return from setitimer(), and everything seemed to be
673 * working fine, except that the pause() just ignored SIGALRM.
674 * I thought maybe the itimer wasn't being fired, so I hit
675 * it with a SIGALRM from the command line, and it ignored
676 * that, too. SIGUSR1 woke it up just fine, and it proceeded
677 * to repoll--but, when the dummy server didn't respond, it
678 * never timed out, and SIGALRM wouldn't make it.
680 * (continued below...)
682 struct itimerval ntimeout;
684 ntimeout.it_interval.tv_sec = 5; /* repeat alarm every 5 secs */
685 ntimeout.it_interval.tv_usec = 0;
686 ntimeout.it_value.tv_sec = run.poll_interval;
687 ntimeout.it_value.tv_usec = 0;
689 siginterrupt(SIGALRM, 1);
691 signal(SIGALRM, gotsigalrm); /* first trap signals */
692 setitimer(ITIMER_REAL,&ntimeout,NULL); /* then start timer */
693 /* there is a very small window between the next two lines */
694 /* which could result in a deadlock. But this will now be */
695 /* caught by periodical alarms (see it_interval) */
699 ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0;
700 ntimeout.it_value.tv_sec = ntimeout.it_value.tv_usec = 0;
701 setitimer(ITIMER_REAL,&ntimeout,NULL); /* now stop timer */
702 signal(SIGALRM, SIG_IGN);
705 * So the workaround I used is to make it sleep by using
706 * select() instead of setitimer()/pause(). select() is
707 * perfectly happy being called with a timeout and
708 * no file descriptors; it just sleeps until it hits the
709 * timeout. The only concern I had was that it might
710 * implement its timeout with SIGALRM--there are some
711 * Unices where this is done, because select() is a library
712 * function--but apparently not.
714 struct timeval timeout;
716 timeout.tv_sec = run.poll_interval;
719 select(0,0,0,0, &timeout);
723 signal(SIGALRM, gotsigalrm);
724 _beginthread(itimerthread, NULL, 32768, NULL);
725 /* see similar code above */
728 signal(SIGALRM, SIG_IGN);
730 if (lastsig == SIGUSR1
731 || ((run.poll_interval && !getuid()) && lastsig == SIGHUP))
733 #ifdef SYS_SIGLIST_DECLARED
734 report(stdout, 0, _("awakened by %s"), sys_siglist[lastsig]);
736 report(stdout, 0, _("awakened by signal %d"), lastsig);
738 /* received a wakeup - unwedge all servers in case */
739 /* the problem has been manually repaired */
740 for (ctl = querylist; ctl; ctl = ctl->next)
745 /* now lock out interrupts again */
746 signal(SIGUSR1, SIG_IGN);
748 signal(SIGHUP, SIG_IGN);
750 if (outlevel >= O_VERBOSE)
751 report(stdout, 0, _("awakened at %s"), rfc822timestamp());
756 if (outlevel >= O_VERBOSE)
757 report(stdout, 0, _("normal termination, status %d"),
758 successes ? PS_SUCCESS : querystatus);
761 exit(successes ? PS_SUCCESS : querystatus);
764 static void optmerge(struct query *h2, struct query *h1, int force)
765 /* merge two options records */
768 * If force is off, modify h2 fields only when they're empty (treat h1
769 * as defaults). If force is on, modify each h2 field whenever h1
770 * is nonempty (treat h1 as an override).
772 #define LIST_MERGE(dstl, srcl) if (force ? !!srcl : !dstl) \
773 free_str_list(&dstl), \
774 append_str_list(&dstl, &srcl)
775 LIST_MERGE(h2->server.localdomains, h1->server.localdomains);
776 LIST_MERGE(h2->localnames, h1->localnames);
777 LIST_MERGE(h2->mailboxes, h1->mailboxes);
778 LIST_MERGE(h2->smtphunt, h1->smtphunt);
779 LIST_MERGE(h2->antispam, h1->antispam);
782 #define FLAG_MERGE(fld) if (force ? !!h1->fld : !h2->fld) h2->fld = h1->fld
783 FLAG_MERGE(server.via);
784 FLAG_MERGE(server.protocol);
786 FLAG_MERGE(server.service);
787 FLAG_MERGE(server.netsec);
789 FLAG_MERGE(server.port);
791 FLAG_MERGE(server.interval);
792 FLAG_MERGE(server.preauthenticate);
793 FLAG_MERGE(server.timeout);
794 FLAG_MERGE(server.envelope);
795 FLAG_MERGE(server.envskip);
796 FLAG_MERGE(server.qvirtual);
797 FLAG_MERGE(server.skip);
798 FLAG_MERGE(server.dns);
799 FLAG_MERGE(server.checkalias);
800 FLAG_MERGE(server.uidl);
803 FLAG_MERGE(server.interface);
804 FLAG_MERGE(server.monitor);
805 FLAG_MERGE(server.interface_pair);
808 FLAG_MERGE(server.plugin);
809 FLAG_MERGE(server.plugout);
810 FLAG_MERGE(wildcard);
811 FLAG_MERGE(remotename);
812 FLAG_MERGE(password);
815 FLAG_MERGE(listener);
816 FLAG_MERGE(smtpaddress);
817 FLAG_MERGE(preconnect);
818 FLAG_MERGE(postconnect);
822 FLAG_MERGE(fetchall);
826 FLAG_MERGE(pass8bits);
827 FLAG_MERGE(dropstatus);
828 FLAG_MERGE(mimedecode);
830 FLAG_MERGE(warnings);
831 FLAG_MERGE(fetchlimit);
832 FLAG_MERGE(batchlimit);
835 FLAG_MERGE(properties);
839 static int load_params(int argc, char **argv, int optind)
841 int implicitmode, st;
843 struct query def_opts, *ctl;
845 memset(&def_opts, '\0', sizeof(struct query));
846 def_opts.smtp_socket = -1;
847 def_opts.smtpaddress = (char *)0;
848 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 571;
849 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 550;
850 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 501;
852 def_opts.server.protocol = P_AUTO;
853 def_opts.server.timeout = CLIENT_TIMEOUT;
854 def_opts.warnings = WARNING_INTERVAL;
855 def_opts.remotename = user;
856 def_opts.expunge = 1;
857 def_opts.listener = SMTP_MODE;
859 /* this builds the host list */
860 if (prc_parse_file(rcfile, !versioninfo) != 0)
863 if ((implicitmode = (optind >= argc)))
865 for (ctl = querylist; ctl; ctl = ctl->next)
869 for (; optind < argc; optind++)
871 flag predeclared = FALSE;
874 * If hostname corresponds to a host known from the rc file,
875 * simply declare it active. Otherwise synthesize a host
876 * record from command line and defaults
878 for (ctl = querylist; ctl; ctl = ctl->next)
879 if (!strcmp(ctl->server.pollname, argv[optind])
880 || str_in_list(&ctl->server.akalist, argv[optind], TRUE))
882 /* Is this correct? */
884 fprintf(stderr,_("Warning: multiple mentions of host %s in config file\n"),argv[optind]);
892 * Allocate and link record without copying in
893 * command-line args; we'll do that with the optmerge
896 ctl = hostalloc((struct query *)NULL);
898 ctl->server.pollname = xstrdup(argv[optind]);
900 ctl->server.lead_server = (struct hostdata *)NULL;
905 * If there's a defaults record, merge it and lose it.
907 if (querylist && strcmp(querylist->server.pollname, "defaults") == 0)
909 for (ctl = querylist->next; ctl; ctl = ctl->next)
910 optmerge(ctl, querylist, FALSE);
911 querylist = querylist->next;
914 /* don't allow a defaults record after the first */
915 for (ctl = querylist; ctl; ctl = ctl->next)
916 if (ctl != querylist && strcmp(ctl->server.pollname, "defaults") == 0)
919 /* use localhost if we never fetch the FQDN of this host */
920 fetchmailhost = "localhost";
922 /* merge in wired defaults, do sanity checks and prepare internal fields */
923 for (ctl = querylist; ctl; ctl = ctl->next)
927 if (configdump || (ctl->active && !(implicitmode && ctl->server.skip)))
929 /* merge in defaults */
930 optmerge(ctl, &def_opts, FALSE);
932 /* force command-line options */
933 optmerge(ctl, &cmd_opts, TRUE);
935 /* this code enables flags to be turned off */
936 #define DEFAULT(flag, dflt) if (flag == FLAG_TRUE)\
938 else if (flag == FLAG_FALSE)\
942 DEFAULT(ctl->keep, FALSE);
943 DEFAULT(ctl->fetchall, FALSE);
944 DEFAULT(ctl->flush, FALSE);
945 DEFAULT(ctl->rewrite, TRUE);
946 DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
947 DEFAULT(ctl->forcecr, FALSE);
948 DEFAULT(ctl->pass8bits, FALSE);
949 DEFAULT(ctl->dropstatus, FALSE);
950 DEFAULT(ctl->mimedecode, TRUE);
951 DEFAULT(ctl->server.dns, TRUE);
952 DEFAULT(ctl->server.uidl, FALSE);
953 DEFAULT(ctl->server.checkalias, FALSE);
957 * DNS support is required for some protocols.
959 * If we're using ETRN, the smtp hunt list is the list of
960 * systems we're polling on behalf of; these have to be
961 * fully-qualified domain names. The default for this list
962 * should be the FQDN of localhost.
964 * If we're using Kerberos for authentication, we need
965 * the FQDN in order to generate capability keys.
967 if (ctl->server.protocol == P_ETRN
968 || ctl->server.preauthenticate == A_KERBEROS_V4
969 || ctl->server.preauthenticate == A_KERBEROS_V5)
970 if (strcmp(fetchmailhost, "localhost") == 0)
971 fetchmailhost = host_fqdn();
974 * Make sure we have a nonempty host list to forward to.
977 save_str(&ctl->smtphunt, fetchmailhost, FALSE);
979 /* if `user' doesn't name a real local user, try to run as root */
980 if ((pw = getpwnam(user)) == (struct passwd *)NULL)
983 ctl->uid = pw->pw_uid; /* for local delivery via MDA */
984 if (!ctl->localnames) /* for local delivery via SMTP */
985 save_str_pair(&ctl->localnames, user, NULL);
987 #if !defined(HAVE_GETHOSTBYNAME) || !defined(HAVE_RES_SEARCH)
988 /* can't handle multidrop mailboxes unless we can do DNS lookups */
989 if (ctl->localnames && ctl->localnames->next && ctl->server.dns)
991 ctl->server.dns = FALSE;
992 fprintf(stderr, _("fetchmail: warning: no DNS available to check multidrop fetches from %s\n"), ctl->server.pollname);
994 #endif /* !HAVE_GETHOSTBYNAME || !HAVE_RES_SEARCH */
998 * Compute the true name of the mailserver host.
999 * There are two clashing cases here:
1001 * (1) The poll name is a label, possibly on one of several
1002 * poll configurations for the same host. In this case
1003 * the `via' option will be present and give the true name.
1005 * (2) The poll name is the true one, the via name is
1006 * localhost. This is going to be typical for ssh-using
1009 * We're going to assume the via name is true unless it's
1012 if (ctl->server.via && strcmp(ctl->server.via, "localhost"))
1013 ctl->server.queryname = xstrdup(ctl->server.via);
1015 ctl->server.queryname = xstrdup(ctl->server.pollname);
1018 /* If either the pollname or vianame are "hesiod" we want to
1019 lookup the user's hesiod pobox host */
1021 if (!strcasecmp(ctl->server.queryname, "hesiod")) {
1022 struct hes_postoffice *hes_p;
1023 hes_p = hes_getmailhost(ctl->remotename);
1024 if (hes_p != NULL && strcmp(hes_p->po_type, "POP") == 0) {
1025 free(ctl->server.queryname);
1026 ctl->server.queryname = xstrdup(hes_p->po_host);
1027 if (ctl->server.via)
1028 free(ctl->server.via);
1029 ctl->server.via = xstrdup(hes_p->po_host);
1031 report(stderr, errno, _("couldn't find HESIOD pobox for %s"),
1038 * We may have to canonicalize the server truename for later use.
1039 * Do this just once for each lead server, if necessary, in order
1040 * to minimize DNS round trips.
1042 if (ctl->server.lead_server)
1043 ctl->server.truename = xstrdup(ctl->server.lead_server->truename);
1044 #ifdef HAVE_GETHOSTBYNAME
1045 else if (ctl->server.preauthenticate==A_KERBEROS_V4 ||
1046 ctl->server.preauthenticate==A_KERBEROS_V5 ||
1047 (ctl->server.dns && MULTIDROP(ctl)))
1049 struct hostent *namerec;
1051 /* compute the canonical name of the host */
1053 namerec = gethostbyname(ctl->server.queryname);
1054 if (namerec == (struct hostent *)NULL)
1056 report(stderr, errno,
1057 _("couldn't find canonical DNS name of %s"),
1058 ctl->server.pollname);
1062 ctl->server.truename=xstrdup((char *)namerec->h_name);
1064 #endif /* HAVE_GETHOSTBYNAME */
1066 ctl->server.truename = xstrdup(ctl->server.queryname);
1068 /* if no folders were specified, set up the null one as default */
1069 if (!ctl->mailboxes)
1070 save_str(&ctl->mailboxes, (char *)NULL, 0);
1072 /* maybe user overrode timeout on command line? */
1073 if (ctl->server.timeout == -1)
1074 ctl->server.timeout = CLIENT_TIMEOUT;
1078 if (ctl->server.port < 0)
1080 (void) fprintf(stderr,
1081 _("%s configuration invalid, port number cannot be negative\n"),
1082 ctl->server.pollname);
1085 if (ctl->server.protocol == P_RPOP && ctl->server.port >= 1024)
1087 (void) fprintf(stderr,
1088 _("%s configuration invalid, RPOP requires a privileged port\n"),
1089 ctl->server.pollname);
1092 if (ctl->listener == LMTP_MODE)
1096 for (idp = ctl->smtphunt; idp; idp = idp->next)
1100 if (!(cp = strrchr(idp->id, '/')) ||
1102 (strcmp(++cp, SMTP_PORT) == 0))
1104 (atoi(++cp) == SMTP_PORT))
1107 (void) fprintf(stderr,
1108 _("%s configuration invalid, LMTP can't use default SMTP port\n"),
1109 ctl->server.pollname);
1118 /* here's where we override globals */
1119 if (cmd_run.logfile)
1120 run.logfile = cmd_run.logfile;
1122 run.idfile = cmd_run.idfile;
1123 if (cmd_run.poll_interval >= 0)
1124 run.poll_interval = cmd_run.poll_interval;
1125 if (cmd_run.invisible)
1126 run.invisible = cmd_run.invisible;
1127 if (cmd_run.use_syslog)
1128 run.use_syslog = (cmd_run.use_syslog == FLAG_TRUE);
1129 if (cmd_run.postmaster)
1130 run.postmaster = cmd_run.postmaster;
1132 /* check and daemon options are not compatible */
1133 if (check_only && run.poll_interval)
1134 run.poll_interval = 0;
1137 /* initialize UID handling */
1138 if (!versioninfo && (st = prc_filecheck(run.idfile, !versioninfo)) != 0)
1141 initialize_saved_lists(querylist, run.idfile);
1142 #endif /* POP3_ENABLE */
1145 * If the user didn't set a last-resort user to get misaddressed
1146 * multidrop mail, set an appropriate default here.
1148 if (!run.postmaster)
1149 if (getuid()) /* ordinary user */
1150 run.postmaster = user;
1152 run.postmaster = "postmaster";
1154 return(implicitmode);
1157 static void termhook(int sig)
1158 /* to be executed on normal or signal-induced termination */
1163 * Sending SMTP QUIT on signal is theoretically nice, but led to a
1164 * subtle bug. If fetchmail was terminated by signal while it was
1165 * shipping message text, it would hang forever waiting for a
1166 * command acknowledge. In theory we could enable the QUIT
1167 * only outside of the message send. In practice, we don't
1168 * care. All mailservers hang up on a dropped TCP/IP connection
1173 report(stdout, 0, _("terminated with signal %d"), sig);
1175 /* terminate all SMTP connections cleanly */
1176 for (ctl = querylist; ctl; ctl = ctl->next)
1177 if (ctl->smtp_socket != -1)
1178 SMTP_quit(ctl->smtp_socket);
1182 write_saved_lists(querylist, run.idfile);
1183 #endif /* POP3_ENABLE */
1186 * Craig Metz, the RFC1938 one-time-password guy, points out:
1187 * "Remember that most kernels don't zero pages before handing them to the
1188 * next process and many kernels share pages between user and kernel space.
1189 * You'd be very surprised what you can find from a short program to do a
1190 * malloc() and then dump the contents of the pages you got. By zeroing
1191 * the secrets at end of run (earlier if you can), you make sure the next
1192 * guy can't get the password/pass phrase."
1194 * Right you are, Craig!
1196 for (ctl = querylist; ctl; ctl = ctl->next)
1198 memset(ctl->password, '\0', strlen(ctl->password));
1200 #if !defined(HAVE_ATEXIT) && !defined(HAVE_ON_EXIT)
1204 exit(successes ? PS_SUCCESS : querystatus);
1208 * Sequence of protocols to try when autoprobing, most capable to least.
1210 static const int autoprobe[] =
1214 #endif /* IMAP_ENABLE */
1217 #endif /* POP3_ENABLE */
1220 #endif /* POP2_ENABLE */
1223 static int query_host(struct query *ctl)
1224 /* perform fetch transaction with single host */
1228 if (outlevel >= O_VERBOSE)
1233 report(stdout, 0, _("%s querying %s (protocol %s) at %s"),
1235 ctl->server.pollname, showproto(ctl->server.protocol), ctime(&now));
1237 switch (ctl->server.protocol) {
1239 for (i = 0; i < sizeof(autoprobe)/sizeof(autoprobe[0]); i++)
1241 ctl->server.protocol = autoprobe[i];
1242 if ((st = query_host(ctl)) == PS_SUCCESS || st == PS_NOMAIL || st == PS_AUTHFAIL || st == PS_LOCKBUSY || st == PS_SMTP)
1245 ctl->server.protocol = P_AUTO;
1250 return(doPOP2(ctl));
1252 report(stderr, 0, _("POP2 support is not configured.\n"));
1253 return(PS_PROTOCOL);
1254 #endif /* POP2_ENABLE */
1260 return(doPOP3(ctl));
1262 report(stderr, 0, _("POP3 support is not configured.\n"));
1263 return(PS_PROTOCOL);
1264 #endif /* POP3_ENABLE */
1272 return(doIMAP(ctl));
1274 report(stderr, 0, _("IMAP support is not configured.\n"));
1275 return(PS_PROTOCOL);
1276 #endif /* IMAP_ENABLE */
1280 report(stderr, 0, _("ETRN support is not configured.\n"));
1281 return(PS_PROTOCOL);
1283 #ifdef HAVE_GETHOSTBYNAME
1284 return(doETRN(ctl));
1286 report(stderr, 0, _("Cannot support ETRN without gethostbyname(2).\n"));
1287 return(PS_PROTOCOL);
1288 #endif /* HAVE_GETHOSTBYNAME */
1289 #endif /* ETRN_ENABLE */
1291 report(stderr, 0, _("unsupported protocol selected."));
1292 return(PS_PROTOCOL);
1296 static void dump_params (struct runctl *runp,
1297 struct query *querylist, flag implicit)
1298 /* display query parameters in English */
1302 if (runp->poll_interval)
1303 printf(_("Poll interval is %d seconds\n"), runp->poll_interval);
1305 printf(_("Logfile is %s\n"), runp->logfile);
1306 if (strcmp(runp->idfile, IDFILE_NAME))
1307 printf(_("Idfile is %s\n"), runp->idfile);
1308 #if defined(HAVE_SYSLOG)
1309 if (runp->use_syslog)
1310 printf(_("Progress messages will be logged via syslog\n"));
1312 if (runp->invisible)
1313 printf(_("Fetchmail will masquerade and will not generate Received\n"));
1314 if (runp->postmaster)
1315 printf(_("Fetchmail will forward misaddressed multidrop messages to %s.\n"),
1318 for (ctl = querylist; ctl; ctl = ctl->next)
1320 if (!ctl->active || (implicit && ctl->server.skip))
1323 printf(_("Options for retrieving from %s@%s:\n"),
1324 ctl->remotename, visbuf(ctl->server.pollname));
1326 if (ctl->server.via && (ctl->server.protocol != P_ETRN))
1327 printf(_(" Mail will be retrieved via %s\n"), ctl->server.via);
1329 if (ctl->server.interval)
1330 printf(_(" Poll of this server will occur every %d intervals.\n"),
1331 ctl->server.interval);
1332 if (ctl->server.truename)
1333 printf(_(" True name of server is %s.\n"), ctl->server.truename);
1334 if (ctl->server.skip || outlevel >= O_VERBOSE)
1335 printf(_(" This host %s be queried when no host is specified.\n"),
1336 ctl->server.skip ? _("will not") : _("will"));
1338 * Don't poll for password when there is one or when using the ETRN
1339 * or IMAP-GSS protocol
1341 if (!ctl->password && (ctl->server.protocol != P_ETRN)
1343 && (ctl->server.protocol != P_IMAP_GSS)
1346 printf(_(" Password will be prompted for.\n"));
1347 else if (outlevel >= O_VERBOSE)
1348 if (ctl->server.protocol == P_APOP)
1349 printf(_(" APOP secret = \"%s\".\n"), visbuf(ctl->password));
1350 else if (ctl->server.protocol == P_RPOP)
1351 printf(_(" RPOP id = \"%s\".\n"), visbuf(ctl->password));
1353 printf(_(" Password = \"%s\".\n"), visbuf(ctl->password));
1354 if (ctl->server.protocol == P_POP3
1356 && !strcmp(ctl->server.service, KPOP_PORT)
1358 && ctl->server.port == KPOP_PORT
1360 && (ctl->server.preauthenticate == A_KERBEROS_V4 ||
1361 ctl->server.preauthenticate == A_KERBEROS_V5))
1362 printf(_(" Protocol is KPOP with Kerberos %s authentication"),
1363 ctl->server.preauthenticate == A_KERBEROS_V5 ? "V" : "IV");
1365 printf(_(" Protocol is %s"), showproto(ctl->server.protocol));
1367 if (ctl->server.service)
1368 printf(_(" (using service %s)"), ctl->server.service);
1369 if (ctl->server.netsec)
1370 printf(_(" (using network security options %s)"), ctl->server.netsec);
1372 if (ctl->server.port)
1373 printf(_(" (using port %d)"), ctl->server.port);
1375 else if (outlevel >= O_VERBOSE)
1376 printf(_(" (using default port)"));
1377 if (ctl->server.uidl && (ctl->server.protocol != P_ETRN))
1378 printf(_(" (forcing UIDL use)"));
1381 if (ctl->server.preauthenticate == A_KERBEROS_V4)
1382 printf(_(" Kerberos V4 preauthentication enabled.\n"));
1383 if (ctl->server.preauthenticate == A_KERBEROS_V5)
1384 printf(_(" Kerberos V5 preauthentication enabled.\n"));
1385 if (ctl->server.timeout > 0)
1386 printf(_(" Server nonresponse timeout is %d seconds"), ctl->server.timeout);
1387 if (ctl->server.timeout == CLIENT_TIMEOUT)
1388 printf(_(" (default).\n"));
1392 if (ctl->server.protocol != P_ETRN) {
1393 if (!ctl->mailboxes->id)
1394 printf(_(" Default mailbox selected.\n"));
1399 printf(_(" Selected mailboxes are:"));
1400 for (idp = ctl->mailboxes; idp; idp = idp->next)
1401 printf(" %s", idp->id);
1404 printf(_(" %s messages will be retrieved (--all %s).\n"),
1405 ctl->fetchall ? _("All") : _("Only new"),
1406 ctl->fetchall ? "on" : "off");
1407 printf(_(" Fetched messages %s be kept on the server (--keep %s).\n"),
1408 ctl->keep ? _("will") : _("will not"),
1409 ctl->keep ? "on" : "off");
1410 printf(_(" Old messages %s be flushed before message retrieval (--flush %s).\n"),
1411 ctl->flush ? _("will") : _("will not"),
1412 ctl->flush ? "on" : "off");
1413 printf(_(" Rewrite of server-local addresses is %s (--norewrite %s).\n"),
1414 ctl->rewrite ? _("enabled") : _("disabled"),
1415 ctl->rewrite ? "off" : "on");
1416 printf(_(" Carriage-return stripping is %s (stripcr %s).\n"),
1417 ctl->stripcr ? _("enabled") : _("disabled"),
1418 ctl->stripcr ? "on" : "off");
1419 printf(_(" Carriage-return forcing is %s (forcecr %s).\n"),
1420 ctl->forcecr ? _("enabled") : _("disabled"),
1421 ctl->forcecr ? "on" : "off");
1422 printf(_(" Interpretation of Content-Transfer-Encoding is %s (pass8bits %s).\n"),
1423 ctl->pass8bits ? _("disabled") : _("enabled"),
1424 ctl->pass8bits ? "on" : "off");
1425 printf(_(" MIME decoding is %s (mimedecode %s).\n"),
1426 ctl->mimedecode ? _("enabled") : _("disabled"),
1427 ctl->mimedecode ? "on" : "off");
1428 printf(_(" Nonempty Status lines will be %s (dropstatus %s)\n"),
1429 ctl->dropstatus ? _("discarded") : _("kept"),
1430 ctl->dropstatus ? "on" : "off");
1431 if (NUM_NONZERO(ctl->limit))
1433 if (NUM_NONZERO(ctl->limit))
1434 printf(_(" Message size limit is %d octets (--limit %d).\n"),
1435 ctl->limit, ctl->limit);
1436 else if (outlevel >= O_VERBOSE)
1437 printf(_(" No message size limit (--limit 0).\n"));
1438 if (run.poll_interval > 0)
1439 printf(_(" Message size warning interval is %d seconds (--warnings %d).\n"),
1440 ctl->warnings, ctl->warnings);
1441 else if (outlevel >= O_VERBOSE)
1442 printf(_(" Size warnings on every poll (--warnings 0).\n"));
1444 if (NUM_NONZERO(ctl->fetchlimit))
1445 printf(_(" Received-message limit is %d (--fetchlimit %d).\n"),
1446 ctl->fetchlimit, ctl->fetchlimit);
1447 else if (outlevel >= O_VERBOSE)
1448 printf(_(" No received-message limit (--fetchlimit 0).\n"));
1449 if (NUM_NONZERO(ctl->batchlimit))
1450 printf(_(" SMTP message batch limit is %d.\n"), ctl->batchlimit);
1451 else if (outlevel >= O_VERBOSE)
1452 printf(_(" No SMTP message batch limit (--batchlimit 0).\n"));
1453 if (ctl->server.protocol == P_IMAP)
1454 if (NUM_NONZERO(ctl->expunge))
1455 printf(_(" Deletion interval between expunges is %d (--expunge %d).\n"), ctl->expunge, ctl->expunge);
1456 else if (outlevel >= O_VERBOSE)
1457 printf(_(" No expunges (--expunge 0).\n"));
1460 printf(_(" Messages will be appended to %s as BSMTP\n"), visbuf(ctl->bsmtp));
1461 else if (ctl->mda && (ctl->server.protocol != P_ETRN))
1462 printf(_(" Messages will be delivered with \"%s\".\n"), visbuf(ctl->mda));
1467 printf(_(" Messages will be %cMTP-forwarded to:"), ctl->listener);
1468 for (idp = ctl->smtphunt; idp; idp = idp->next)
1470 printf(" %s", idp->id);
1471 if (!idp->val.status.mark)
1472 printf(_(" (default)"));
1475 if (ctl->smtpaddress)
1476 printf(_(" Host part of MAIL FROM line will be %s\n"),
1479 if (ctl->server.protocol != P_ETRN)
1481 if (ctl->antispam != (struct idlist *)NULL)
1485 printf(_(" Recognized listener spam block responses are:"));
1486 for (idp = ctl->antispam; idp; idp = idp->next)
1487 printf(" %d", idp->val.status.num);
1490 else if (outlevel >= O_VERBOSE)
1491 printf(_(" Spam-blocking disabled\n"));
1493 if (ctl->preconnect)
1494 printf(_(" Server connection will be brought up with \"%s\".\n"),
1495 visbuf(ctl->preconnect));
1496 else if (outlevel >= O_VERBOSE)
1497 printf(_(" No pre-connection command.\n"));
1498 if (ctl->postconnect)
1499 printf(_(" Server connection will be taken down with \"%s\".\n"),
1500 visbuf(ctl->postconnect));
1501 else if (outlevel >= O_VERBOSE)
1502 printf(_(" No post-connection command.\n"));
1503 if (ctl->server.protocol != P_ETRN) {
1504 if (!ctl->localnames)
1505 printf(_(" No localnames declared for this host.\n"));
1511 for (idp = ctl->localnames; idp; idp = idp->next)
1514 if (count > 1 || ctl->wildcard)
1515 printf(_(" Multi-drop mode: "));
1517 printf(_(" Single-drop mode: "));
1519 printf(_("%d local name(s) recognized.\n"), count);
1520 if (outlevel >= O_VERBOSE)
1522 for (idp = ctl->localnames; idp; idp = idp->next)
1524 printf("\t%s -> %s\n", idp->id, idp->val.id2);
1526 printf("\t%s\n", idp->id);
1528 fputs("\t*\n", stdout);
1531 if (count > 1 || ctl->wildcard)
1533 printf(_(" DNS lookup for multidrop addresses is %s.\n"),
1534 ctl->server.dns ? _("enabled") : _("disabled"));
1535 if (ctl->server.dns)
1537 printf(_(" Server aliases will be compared with multidrop addresses by "));
1538 if (ctl->server.checkalias)
1539 printf(_("IP address.\n"));
1541 printf(_("name.\n"));
1543 if (ctl->server.envelope == STRING_DISABLED)
1544 printf(_(" Envelope-address routing is disabled\n"));
1547 printf(_(" Envelope header is assumed to be: %s\n"),
1548 ctl->server.envelope ? ctl->server.envelope:_("Received"));
1549 if (ctl->server.envskip > 1 || outlevel >= O_VERBOSE)
1550 printf(_(" Number of envelope header to be parsed: %d\n"),
1551 ctl->server.envskip);
1552 if (ctl->server.qvirtual)
1553 printf(_(" Prefix %s will be removed from user id\n"),
1554 ctl->server.qvirtual);
1555 else if (outlevel >= O_VERBOSE)
1556 printf(_(" No prefix stripping\n"));
1559 if (ctl->server.akalist)
1563 printf(_(" Predeclared mailserver aliases:"));
1564 for (idp = ctl->server.akalist; idp; idp = idp->next)
1565 printf(" %s", idp->id);
1568 if (ctl->server.localdomains)
1572 printf(_(" Local domains:"));
1573 for (idp = ctl->server.localdomains; idp; idp = idp->next)
1574 printf(" %s", idp->id);
1581 if (ctl->server.interface)
1582 printf(_(" Connection must be through interface %s.\n"), ctl->server.interface);
1583 else if (outlevel >= O_VERBOSE)
1584 printf(_(" No interface requirement specified.\n"));
1585 if (ctl->server.monitor)
1586 printf(_(" Polling loop will monitor %s.\n"), ctl->server.monitor);
1587 else if (outlevel >= O_VERBOSE)
1588 printf(_(" No monitor interface specified.\n"));
1591 if (ctl->server.plugin)
1592 printf(_(" Server connections will be mode via plugin %s (--plugin %s).\n"), ctl->server.plugin, ctl->server.plugin);
1593 else if (outlevel >= O_VERBOSE)
1594 printf(_(" No plugin command specified.\n"));
1595 if (ctl->server.plugout)
1596 printf(_(" Listener connections will be mode via plugout %s (--plugout %s).\n"), ctl->server.plugout, ctl->server.plugout);
1597 else if (outlevel >= O_VERBOSE)
1598 printf(_(" No plugout command specified.\n"));
1600 if (ctl->server.protocol > P_POP2 && (ctl->server.protocol != P_ETRN))
1602 printf(_(" No UIDs saved from this host.\n"));
1608 for (idp = ctl->oldsaved; idp; idp = idp->next)
1611 printf(_(" %d UIDs saved.\n"), count);
1612 if (outlevel >= O_VERBOSE)
1613 for (idp = ctl->oldsaved; idp; idp = idp->next)
1614 printf("\t%s\n", idp->id);
1617 if (ctl->properties)
1618 printf(_(" Pass-through properties \"%s\".\n"),
1619 visbuf(ctl->properties));
1623 /* fetchmail.c ends here */