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)
169 printf(_("This is fetchmail release %s"), VERSION);
172 #endif /* POP2_ENABLE */
175 #endif /* POP3_ENABLE */
178 #endif /* IMAP_ENABLE */
184 #endif /* RPA_ENABLE */
187 #endif /* SDPS_ENABLE */
190 #endif /* ETRN_ENABLE */
199 #endif /* NET_SECURITY */
204 #endif /* HAVE_SOCKS */
207 #endif /* ENABLE_NLS */
210 /* this is an attempt to help remote debugging */
214 /* avoid parsing the config file if all we're doing is killing a daemon */
215 if (!(quitmode && argc == 2))
216 implicitmode = load_params(argc, argv, optind);
218 /* set up to do lock protocol */
219 #define FETCHMAIL_PIDFILE "fetchmail.pid"
221 xalloca(tmpbuf, char *,
222 strlen(PID_DIR) + strlen(FETCHMAIL_PIDFILE) + 2);
223 sprintf(tmpbuf, "%s/%s", PID_DIR, FETCHMAIL_PIDFILE);
225 xalloca(tmpbuf, char *, strlen(home) + strlen(FETCHMAIL_PIDFILE) + 3);
226 strcpy(tmpbuf, home);
227 strcat(tmpbuf, "/.");
228 strcat(tmpbuf, FETCHMAIL_PIDFILE);
230 #undef FETCHMAIL_PIDFILE
232 /* perhaps we just want to check options? */
235 printf(_("Taking options from command line"));
236 if (access(rcfile, 0))
239 printf(_(" and %s\n"), rcfile);
240 if (outlevel >= O_VERBOSE)
241 printf(_("Lockfile at %s\n"), tmpbuf);
243 if (querylist == NULL)
244 (void) fprintf(stderr,
245 _("No mailservers set up -- perhaps %s is missing?\n"), rcfile);
247 dump_params(&run, querylist, implicitmode);
251 /* dump options as a Python dictionary, for configurator use */
254 dump_config(&run, querylist);
258 /* check for another fetchmail running concurrently */
260 if ((lockfile = (char *) malloc(strlen(tmpbuf) + 1)) == NULL)
262 fprintf(stderr,_("fetchmail: cannot allocate memory for lock name.\n"));
266 (void) strcpy(lockfile, tmpbuf);
267 if ((lockfp = fopen(lockfile, "r")) != NULL )
269 bkgd = (fscanf(lockfp,"%d %d", &pid, &st) == 2);
271 if (kill(pid, 0) == -1) {
272 fprintf(stderr,_("fetchmail: removing stale lockfile\n"));
280 /* if no mail servers listed and nothing in background, we're done */
281 if (!(quitmode && argc == 2) && pid == -1 && querylist == NULL) {
282 (void)fputs(_("fetchmail: no mailservers have been specified.\n"),stderr);
286 /* perhaps user asked us to kill the other fetchmail */
291 fprintf(stderr,_("fetchmail: no other fetchmail is running\n"));
295 else if (kill(pid, SIGTERM) < 0)
297 fprintf(stderr,_("fetchmail: error killing %s fetchmail at %d; bailing out.\n"),
298 bkgd ? _("background") : _("foreground"), pid);
303 fprintf(stderr,_("fetchmail: %s fetchmail at %d killed.\n"),
304 bkgd ? _("background") : _("foreground"), pid);
313 /* another fetchmail is running -- wake it up or die */
319 _("fetchmail: can't check mail while another fetchmail to same host is running.\n"));
322 else if (!implicitmode)
325 _("fetchmail: can't poll specified hosts with another fetchmail running at %d.\n"),
332 _("fetchmail: another foreground fetchmail is running at %d.\n"),
339 _("fetchmail: can't accept options while a background fetchmail is running.\n"));
342 else if (kill(pid, SIGUSR1) == 0)
345 _("fetchmail: background fetchmail at %d awakened.\n"),
352 * Should never happen -- possible only if a background fetchmail
353 * croaks after the first kill probe above but before the
354 * SIGUSR1/SIGHUP transmission.
357 _("fetchmail: elder sibling at %d died mysteriously.\n"),
359 return(PS_UNDEFINED);
363 /* parse the ~/.netrc file (if present) for future password lookups. */
364 xalloca(netrc_file, char *, strlen (home) + 8);
365 strcpy (netrc_file, home);
366 strcat (netrc_file, "/.netrc");
367 netrc_list = parse_netrc(netrc_file);
369 #ifdef HAVE_SETRLIMIT
371 * Before getting passwords, disable core dumps unless -v -d0 mode is on.
372 * Core dumps could otherwise contain passwords to be scavenged by a
375 if (outlevel < O_VERBOSE || run.poll_interval > 0)
377 struct rlimit corelimit;
378 corelimit.rlim_cur = 0;
379 corelimit.rlim_max = 0;
380 setrlimit(RLIMIT_CORE, &corelimit);
382 #endif /* HAVE_SETRLIMIT */
384 /* pick up interactively any passwords we need but don't have */
385 for (ctl = querylist; ctl; ctl = ctl->next)
387 if (ctl->active && !(implicitmode && ctl->server.skip)&&!ctl->password)
389 if (ctl->server.preauthenticate == A_KERBEROS_V4 ||
390 ctl->server.preauthenticate == A_KERBEROS_V5 ||
392 ctl->server.protocol == P_IMAP_GSS ||
394 ctl->server.protocol == P_IMAP_K4)
395 /* Server won't care what the password is, but there
396 must be some non-null string here. */
397 ctl->password = ctl->remotename;
402 /* look up the pollname and account in the .netrc file. */
403 p = search_netrc(netrc_list, ctl->server.pollname);
404 while (p && strcmp(p->account, ctl->remotename))
405 p = search_netrc(p->next, ctl->remotename);
406 /* if we find a matching entry with a password, use it */
407 if (p && p->password)
408 ctl->password = xstrdup(p->password);
410 /* otherwise try with "via" name if there is one */
411 else if (ctl->server.via)
413 p = search_netrc(netrc_list, ctl->server.via);
414 while (p && strcmp(p->account, ctl->remotename))
415 p = search_netrc(p->next, ctl->remotename);
416 if (p && p->password)
417 ctl->password = xstrdup(p->password);
421 if (ctl->server.protocol != P_ETRN && ctl->server.protocol != P_IMAP_K4
423 && ctl->server.protocol != P_IMAP_GSS
427 char* password_prompt = _("Enter password for %s@%s: ");
429 xalloca(tmpbuf, char *, strlen(password_prompt) +
430 strlen(ctl->remotename) +
431 strlen(ctl->server.pollname) + 1);
432 (void) sprintf(tmpbuf, password_prompt,
433 ctl->remotename, ctl->server.pollname);
434 ctl->password = xstrdup((char *)getpassword(tmpbuf));
439 /* Time to initiate the SOCKS library (this is not mandatory: it just
440 registers the correct application name for logging purpose. If you
441 have some problem, comment these lines). */
444 /* Mmmh... I don't like hardcoded application names,
445 but "fetchmail" is everywhere... */
446 SOCKSinit("fetchmail");
448 #endif /* HAVE_SOCKS */
451 * Maybe time to go to demon mode...
453 #if defined(HAVE_SYSLOG)
456 openlog(program_name, LOG_PID, LOG_MAIL);
461 report_init((run.poll_interval == 0 || nodetach) && !run.logfile);
463 if (run.poll_interval)
466 daemonize(run.logfile, termhook);
467 report(stdout, 0, _("starting fetchmail %s daemon \n"), VERSION);
470 * We'll set up a handler for these when we're sleeping,
471 * but ignore them otherwise so as not to interrupt a poll.
473 signal(SIGUSR1, SIG_IGN);
474 if (run.poll_interval && !getuid())
475 signal(SIGHUP, SIG_IGN);
482 /* beyond here we don't want more than one fetchmail running per user */
484 signal(SIGABRT, termhook);
485 signal(SIGINT, termhook);
486 signal(SIGTERM, termhook);
487 signal(SIGALRM, termhook);
488 signal(SIGPIPE, termhook);
489 signal(SIGQUIT, termhook);
491 /* here's the exclusion lock */
492 if ((lockfp = fopen(lockfile,"w")) != NULL) {
493 fprintf(lockfp,"%d",getpid());
494 if (run.poll_interval)
495 fprintf(lockfp," %d", run.poll_interval);
502 on_exit(unlockit, (char *)NULL);
507 * Query all hosts. If there's only one, the error return will
508 * reflect the status of that transaction.
511 #if defined(HAVE_RES_SEARCH) && defined(USE_TCPIP_FOR_DNS)
513 * This was an efficiency hack that backfired. The theory
514 * was that using TCP/IP for DNS queries would get us better
515 * reliability and shave off some per-UDP-packet costs.
516 * Unfortunately it interacted badly with diald, which effectively
517 * filters out DNS queries over TCP/IP for reasons having to do
518 * with some obscure kernel problem involving bootstrapping of
519 * dynamically-addressed links. I don't understand this mess
520 * and don't want to, so it's "See ya!" to this hack.
522 sethostent(TRUE); /* use TCP/IP for mailserver queries */
523 #endif /* HAVE_RES_SEARCH */
526 for (ctl = querylist; ctl; ctl = ctl->next)
528 if (ctl->active && !(implicitmode && ctl->server.skip))
533 _("poll of %s skipped (failed authentication or too many timeouts)\n"),
534 ctl->server.pollname);
538 /* check skip interval first so that it counts all polls */
539 if (run.poll_interval && ctl->server.interval)
541 if (ctl->server.poll_count++ % ctl->server.interval)
543 if (outlevel >= O_VERBOSE)
545 _("interval not reached, not querying %s\n"),
546 ctl->server.pollname);
551 #if defined(linux) && !INET6
552 /* interface_approve() does its own error logging */
553 if (!interface_approve(&ctl->server))
555 #endif /* defined(linux) && !INET6 */
557 querystatus = query_host(ctl);
559 if (querystatus == PS_SUCCESS)
564 update_str_lists(ctl);
566 /* Save UID list to prevent re-fetch in case fetchmail
567 recover from crash */
570 write_saved_lists(querylist, run.idfile);
571 if (outlevel >= O_DEBUG)
572 report(stdout, 0, _("saved UID List\n"));
574 #endif /* POP3_ENABLE */
576 else if (!check_only &&
577 ((querystatus!=PS_NOMAIL) || (outlevel==O_DEBUG)))
578 report(stdout, 0, _("Query status=%d\n"), querystatus);
580 #if defined(linux) && !INET6
581 if (ctl->server.monitor)
584 * Allow some time for the link to quiesce. One
585 * second is usually sufficient, three is safe.
586 * Note: this delay is important - don't remove!
589 interface_note_activity(&ctl->server);
591 #endif /* defined(linux) && !INET6 */
595 #if defined(HAVE_RES_SEARCH) && defined(USE_TCPIP_FOR_DNS)
596 endhostent(); /* release TCP/IP connection to nameserver */
597 #endif /* HAVE_RES_SEARCH */
600 * Close all SMTP delivery sockets. For optimum performance
601 * we'd like to hold them open til end of run, but (1) this
602 * loses if our poll interval is longer than the MTA's inactivity
603 * timeout, and (2) some MTAs (like smail) don't deliver after
604 * each message, but rather queue up mail and wait to actually
605 * deliver it until the input socket is closed.
607 for (ctl = querylist; ctl; ctl = ctl->next)
608 if (ctl->smtp_socket != -1)
610 SMTP_quit(ctl->smtp_socket);
611 close(ctl->smtp_socket);
612 ctl->smtp_socket = -1;
616 * OK, we've polled. Now sleep.
618 if (run.poll_interval)
621 * Because passwords can expire, it may happen that *all*
622 * hosts are now out of the loop due to authfail
623 * conditions. If this happens daemon-mode fetchmail
624 * should softly and silently vanish away, rather than
625 * spinning uselessly.
629 for (ctl = querylist; ctl; ctl = ctl->next)
630 if (ctl->active && !(implicitmode && ctl->server.skip))
635 report(stderr, 0, _("All connections are wedged. Exiting.\n"));
639 if (outlevel >= O_VERBOSE)
641 _("fetchmail: sleeping at %s\n"), rfc822timestamp());
644 * With this simple hack, we make it possible for a foreground
645 * fetchmail to wake up one in daemon mode. What we want is the
646 * side effect of interrupting any sleep that may be going on,
647 * forcing fetchmail to re-poll its hosts. The second line is
648 * for people who think all system daemons wake up on SIGHUP.
650 signal(SIGUSR1, donothing);
652 signal(SIGHUP, donothing);
654 /* time for a pause in the action... */
657 #ifdef SLEEP_WITH_ALARM /* not normally on */
659 * We can't use sleep(3) here because we need an alarm(3)
660 * equivalent in order to implement server nonresponse timeout.
661 * We'll just assume setitimer(2) is available since fetchmail
662 * has to have a BSDoid socket layer to work at all.
665 * This code stopped working under glibc-2, apparently due
666 * to the change in signal(2) semantics. (The siginterrupt
667 * line, added later, should fix this problem.) John Stracke
668 * <francis@netscape.com> wrote:
670 * The problem seems to be that, after hitting the interval
671 * timer while talking to the server, the process no longer
672 * responds to SIGALRM. I put in printf()s to see when it
673 * reached the pause() for the poll interval, and I checked
674 * the return from setitimer(), and everything seemed to be
675 * working fine, except that the pause() just ignored SIGALRM.
676 * I thought maybe the itimer wasn't being fired, so I hit
677 * it with a SIGALRM from the command line, and it ignored
678 * that, too. SIGUSR1 woke it up just fine, and it proceeded
679 * to repoll--but, when the dummy server didn't respond, it
680 * never timed out, and SIGALRM wouldn't make it.
682 * (continued below...)
684 struct itimerval ntimeout;
686 ntimeout.it_interval.tv_sec = 5; /* repeat alarm every 5 secs */
687 ntimeout.it_interval.tv_usec = 0;
688 ntimeout.it_value.tv_sec = run.poll_interval;
689 ntimeout.it_value.tv_usec = 0;
691 siginterrupt(SIGALRM, 1);
693 signal(SIGALRM, gotsigalrm); /* first trap signals */
694 setitimer(ITIMER_REAL,&ntimeout,NULL); /* then start timer */
695 /* there is a very small window between the next two lines */
696 /* which could result in a deadlock. But this will now be */
697 /* caught by periodical alarms (see it_interval) */
701 ntimeout.it_interval.tv_sec = ntimeout.it_interval.tv_usec = 0;
702 ntimeout.it_value.tv_sec = ntimeout.it_value.tv_usec = 0;
703 setitimer(ITIMER_REAL,&ntimeout,NULL); /* now stop timer */
704 signal(SIGALRM, SIG_IGN);
707 * So the workaround I used is to make it sleep by using
708 * select() instead of setitimer()/pause(). select() is
709 * perfectly happy being called with a timeout and
710 * no file descriptors; it just sleeps until it hits the
711 * timeout. The only concern I had was that it might
712 * implement its timeout with SIGALRM--there are some
713 * Unices where this is done, because select() is a library
714 * function--but apparently not.
716 struct timeval timeout;
718 timeout.tv_sec = run.poll_interval;
721 select(0,0,0,0, &timeout);
725 signal(SIGALRM, gotsigalrm);
726 _beginthread(itimerthread, NULL, 32768, NULL);
727 /* see similar code above */
730 signal(SIGALRM, SIG_IGN);
732 if (lastsig == SIGUSR1
733 || ((run.poll_interval && !getuid()) && lastsig == SIGHUP))
735 #ifdef SYS_SIGLIST_DECLARED
737 _("awakened by %s\n"), sys_siglist[lastsig]);
740 _("awakened by signal %d\n"), lastsig);
742 /* received a wakeup - unwedge all servers in case */
743 /* the problem has been manually repaired */
744 for (ctl = querylist; ctl; ctl = ctl->next)
749 /* now lock out interrupts again */
750 signal(SIGUSR1, SIG_IGN);
752 signal(SIGHUP, SIG_IGN);
754 if (outlevel >= O_VERBOSE)
755 report(stdout, 0, _("awakened at %s\n"), rfc822timestamp());
760 if (outlevel >= O_VERBOSE)
761 report(stdout, 0, _("normal termination, status %d\n"),
762 successes ? PS_SUCCESS : querystatus);
765 exit(successes ? PS_SUCCESS : querystatus);
768 static void optmerge(struct query *h2, struct query *h1, int force)
769 /* merge two options records */
772 * If force is off, modify h2 fields only when they're empty (treat h1
773 * as defaults). If force is on, modify each h2 field whenever h1
774 * is nonempty (treat h1 as an override).
776 #define LIST_MERGE(dstl, srcl) if (force ? !!srcl : !dstl) \
777 free_str_list(&dstl), \
778 append_str_list(&dstl, &srcl)
779 LIST_MERGE(h2->server.localdomains, h1->server.localdomains);
780 LIST_MERGE(h2->localnames, h1->localnames);
781 LIST_MERGE(h2->mailboxes, h1->mailboxes);
782 LIST_MERGE(h2->smtphunt, h1->smtphunt);
783 LIST_MERGE(h2->antispam, h1->antispam);
786 #define FLAG_MERGE(fld) if (force ? !!h1->fld : !h2->fld) h2->fld = h1->fld
787 FLAG_MERGE(server.via);
788 FLAG_MERGE(server.protocol);
790 FLAG_MERGE(server.service);
791 FLAG_MERGE(server.netsec);
793 FLAG_MERGE(server.port);
795 FLAG_MERGE(server.interval);
796 FLAG_MERGE(server.preauthenticate);
797 FLAG_MERGE(server.timeout);
798 FLAG_MERGE(server.envelope);
799 FLAG_MERGE(server.envskip);
800 FLAG_MERGE(server.qvirtual);
801 FLAG_MERGE(server.skip);
802 FLAG_MERGE(server.dns);
803 FLAG_MERGE(server.checkalias);
804 FLAG_MERGE(server.uidl);
807 FLAG_MERGE(server.interface);
808 FLAG_MERGE(server.monitor);
809 FLAG_MERGE(server.interface_pair);
812 FLAG_MERGE(server.plugin);
813 FLAG_MERGE(server.plugout);
814 FLAG_MERGE(wildcard);
815 FLAG_MERGE(remotename);
816 FLAG_MERGE(password);
819 FLAG_MERGE(listener);
820 FLAG_MERGE(smtpaddress);
821 FLAG_MERGE(preconnect);
822 FLAG_MERGE(postconnect);
826 FLAG_MERGE(fetchall);
830 FLAG_MERGE(pass8bits);
831 FLAG_MERGE(dropstatus);
832 FLAG_MERGE(mimedecode);
834 FLAG_MERGE(warnings);
835 FLAG_MERGE(fetchlimit);
836 FLAG_MERGE(batchlimit);
839 FLAG_MERGE(properties);
843 static int load_params(int argc, char **argv, int optind)
845 int implicitmode, st;
847 struct query def_opts, *ctl;
849 memset(&def_opts, '\0', sizeof(struct query));
850 def_opts.smtp_socket = -1;
851 def_opts.smtpaddress = (char *)0;
852 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 571;
853 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 550;
854 save_str(&def_opts.antispam, STRING_DUMMY, 0)->val.status.num = 501;
856 def_opts.server.protocol = P_AUTO;
857 def_opts.server.timeout = CLIENT_TIMEOUT;
858 def_opts.warnings = WARNING_INTERVAL;
859 def_opts.remotename = user;
860 def_opts.expunge = 1;
861 def_opts.listener = SMTP_MODE;
863 /* this builds the host list */
864 if (prc_parse_file(rcfile, !versioninfo) != 0)
867 if ((implicitmode = (optind >= argc)))
869 for (ctl = querylist; ctl; ctl = ctl->next)
873 for (; optind < argc; optind++)
875 flag predeclared = FALSE;
878 * If hostname corresponds to a host known from the rc file,
879 * simply declare it active. Otherwise synthesize a host
880 * record from command line and defaults
882 for (ctl = querylist; ctl; ctl = ctl->next)
883 if (!strcmp(ctl->server.pollname, argv[optind])
884 || str_in_list(&ctl->server.akalist, argv[optind], TRUE))
886 /* Is this correct? */
888 fprintf(stderr,_("Warning: multiple mentions of host %s in config file\n"),argv[optind]);
896 * Allocate and link record without copying in
897 * command-line args; we'll do that with the optmerge
900 ctl = hostalloc((struct query *)NULL);
902 ctl->server.pollname = xstrdup(argv[optind]);
904 ctl->server.lead_server = (struct hostdata *)NULL;
909 * If there's a defaults record, merge it and lose it.
911 if (querylist && strcmp(querylist->server.pollname, "defaults") == 0)
913 for (ctl = querylist->next; ctl; ctl = ctl->next)
914 optmerge(ctl, querylist, FALSE);
915 querylist = querylist->next;
918 /* don't allow a defaults record after the first */
919 for (ctl = querylist; ctl; ctl = ctl->next)
920 if (ctl != querylist && strcmp(ctl->server.pollname, "defaults") == 0)
923 /* use localhost if we never fetch the FQDN of this host */
924 fetchmailhost = "localhost";
926 /* merge in wired defaults, do sanity checks and prepare internal fields */
927 for (ctl = querylist; ctl; ctl = ctl->next)
931 if (configdump || (ctl->active && !(implicitmode && ctl->server.skip)))
933 /* merge in defaults */
934 optmerge(ctl, &def_opts, FALSE);
936 /* force command-line options */
937 optmerge(ctl, &cmd_opts, TRUE);
939 /* this code enables flags to be turned off */
940 #define DEFAULT(flag, dflt) if (flag == FLAG_TRUE)\
942 else if (flag == FLAG_FALSE)\
946 DEFAULT(ctl->keep, FALSE);
947 DEFAULT(ctl->fetchall, FALSE);
948 DEFAULT(ctl->flush, FALSE);
949 DEFAULT(ctl->rewrite, TRUE);
950 DEFAULT(ctl->stripcr, (ctl->mda != (char *)NULL));
951 DEFAULT(ctl->forcecr, FALSE);
952 DEFAULT(ctl->pass8bits, FALSE);
953 DEFAULT(ctl->dropstatus, FALSE);
954 DEFAULT(ctl->mimedecode, TRUE);
955 DEFAULT(ctl->server.dns, TRUE);
956 DEFAULT(ctl->server.uidl, FALSE);
957 DEFAULT(ctl->server.checkalias, FALSE);
961 * DNS support is required for some protocols.
963 * If we're using ETRN, the smtp hunt list is the list of
964 * systems we're polling on behalf of; these have to be
965 * fully-qualified domain names. The default for this list
966 * should be the FQDN of localhost.
968 * If we're using Kerberos for authentication, we need
969 * the FQDN in order to generate capability keys.
971 if (ctl->server.protocol == P_ETRN
972 || ctl->server.preauthenticate == A_KERBEROS_V4
973 || ctl->server.preauthenticate == A_KERBEROS_V5)
974 if (strcmp(fetchmailhost, "localhost") == 0)
975 fetchmailhost = host_fqdn();
978 * Make sure we have a nonempty host list to forward to.
981 save_str(&ctl->smtphunt, fetchmailhost, FALSE);
983 /* if `user' doesn't name a real local user, try to run as root */
984 if ((pw = getpwnam(user)) == (struct passwd *)NULL)
987 ctl->uid = pw->pw_uid; /* for local delivery via MDA */
988 if (!ctl->localnames) /* for local delivery via SMTP */
989 save_str_pair(&ctl->localnames, user, NULL);
991 #if !defined(HAVE_GETHOSTBYNAME) || !defined(HAVE_RES_SEARCH)
992 /* can't handle multidrop mailboxes unless we can do DNS lookups */
993 if (ctl->localnames && ctl->localnames->next && ctl->server.dns)
995 ctl->server.dns = FALSE;
996 fprintf(stderr, _("fetchmail: warning: no DNS available to check multidrop fetches from %s\n"), ctl->server.pollname);
998 #endif /* !HAVE_GETHOSTBYNAME || !HAVE_RES_SEARCH */
1002 * Compute the true name of the mailserver host.
1003 * There are two clashing cases here:
1005 * (1) The poll name is a label, possibly on one of several
1006 * poll configurations for the same host. In this case
1007 * the `via' option will be present and give the true name.
1009 * (2) The poll name is the true one, the via name is
1010 * localhost. This is going to be typical for ssh-using
1013 * We're going to assume the via name is true unless it's
1016 if (ctl->server.via && strcmp(ctl->server.via, "localhost"))
1017 ctl->server.queryname = xstrdup(ctl->server.via);
1019 ctl->server.queryname = xstrdup(ctl->server.pollname);
1022 /* If either the pollname or vianame are "hesiod" we want to
1023 lookup the user's hesiod pobox host */
1025 if (!strcasecmp(ctl->server.queryname, "hesiod")) {
1026 struct hes_postoffice *hes_p;
1027 hes_p = hes_getmailhost(ctl->remotename);
1028 if (hes_p != NULL && strcmp(hes_p->po_type, "POP") == 0) {
1029 free(ctl->server.queryname);
1030 ctl->server.queryname = xstrdup(hes_p->po_host);
1031 if (ctl->server.via)
1032 free(ctl->server.via);
1033 ctl->server.via = xstrdup(hes_p->po_host);
1035 report(stderr, errno,
1036 _("couldn't find HESIOD pobox for %s\n"),
1043 * We may have to canonicalize the server truename for later use.
1044 * Do this just once for each lead server, if necessary, in order
1045 * to minimize DNS round trips.
1047 if (ctl->server.lead_server)
1048 ctl->server.truename = xstrdup(ctl->server.lead_server->truename);
1049 #ifdef HAVE_GETHOSTBYNAME
1050 else if (ctl->server.preauthenticate==A_KERBEROS_V4 ||
1051 ctl->server.preauthenticate==A_KERBEROS_V5 ||
1052 (ctl->server.dns && MULTIDROP(ctl)))
1054 struct hostent *namerec;
1056 /* compute the canonical name of the host */
1058 namerec = gethostbyname(ctl->server.queryname);
1059 if (namerec == (struct hostent *)NULL)
1061 report(stderr, errno,
1062 _("couldn't find canonical DNS name of %s\n"),
1063 ctl->server.pollname);
1067 ctl->server.truename=xstrdup((char *)namerec->h_name);
1069 #endif /* HAVE_GETHOSTBYNAME */
1071 ctl->server.truename = xstrdup(ctl->server.queryname);
1073 /* if no folders were specified, set up the null one as default */
1074 if (!ctl->mailboxes)
1075 save_str(&ctl->mailboxes, (char *)NULL, 0);
1077 /* maybe user overrode timeout on command line? */
1078 if (ctl->server.timeout == -1)
1079 ctl->server.timeout = CLIENT_TIMEOUT;
1083 if (ctl->server.port < 0)
1085 (void) fprintf(stderr,
1086 _("%s configuration invalid, port number cannot be negative\n"),
1087 ctl->server.pollname);
1090 if (ctl->server.protocol == P_RPOP && ctl->server.port >= 1024)
1092 (void) fprintf(stderr,
1093 _("%s configuration invalid, RPOP requires a privileged port\n"),
1094 ctl->server.pollname);
1097 if (ctl->listener == LMTP_MODE)
1101 for (idp = ctl->smtphunt; idp; idp = idp->next)
1105 if (!(cp = strrchr(idp->id, '/')) ||
1107 (strcmp(++cp, SMTP_PORT) == 0))
1109 (atoi(++cp) == SMTP_PORT))
1112 (void) fprintf(stderr,
1113 _("%s configuration invalid, LMTP can't use default SMTP port\n"),
1114 ctl->server.pollname);
1123 /* here's where we override globals */
1124 if (cmd_run.logfile)
1125 run.logfile = cmd_run.logfile;
1127 run.idfile = cmd_run.idfile;
1128 if (cmd_run.poll_interval >= 0)
1129 run.poll_interval = cmd_run.poll_interval;
1130 if (cmd_run.invisible)
1131 run.invisible = cmd_run.invisible;
1132 if (cmd_run.use_syslog)
1133 run.use_syslog = (cmd_run.use_syslog == FLAG_TRUE);
1134 if (cmd_run.postmaster)
1135 run.postmaster = cmd_run.postmaster;
1137 /* check and daemon options are not compatible */
1138 if (check_only && run.poll_interval)
1139 run.poll_interval = 0;
1142 /* initialize UID handling */
1143 if (!versioninfo && (st = prc_filecheck(run.idfile, !versioninfo)) != 0)
1146 initialize_saved_lists(querylist, run.idfile);
1147 #endif /* POP3_ENABLE */
1150 * If the user didn't set a last-resort user to get misaddressed
1151 * multidrop mail, set an appropriate default here.
1153 if (!run.postmaster)
1154 if (getuid()) /* ordinary user */
1155 run.postmaster = user;
1157 run.postmaster = "postmaster";
1159 return(implicitmode);
1162 static void termhook(int sig)
1163 /* to be executed on normal or signal-induced termination */
1168 * Sending SMTP QUIT on signal is theoretically nice, but led to a
1169 * subtle bug. If fetchmail was terminated by signal while it was
1170 * shipping message text, it would hang forever waiting for a
1171 * command acknowledge. In theory we could enable the QUIT
1172 * only outside of the message send. In practice, we don't
1173 * care. All mailservers hang up on a dropped TCP/IP connection
1178 report(stdout, 0, _("terminated with signal %d\n"), sig);
1180 /* terminate all SMTP connections cleanly */
1181 for (ctl = querylist; ctl; ctl = ctl->next)
1182 if (ctl->smtp_socket != -1)
1183 SMTP_quit(ctl->smtp_socket);
1187 write_saved_lists(querylist, run.idfile);
1188 #endif /* POP3_ENABLE */
1191 * Craig Metz, the RFC1938 one-time-password guy, points out:
1192 * "Remember that most kernels don't zero pages before handing them to the
1193 * next process and many kernels share pages between user and kernel space.
1194 * You'd be very surprised what you can find from a short program to do a
1195 * malloc() and then dump the contents of the pages you got. By zeroing
1196 * the secrets at end of run (earlier if you can), you make sure the next
1197 * guy can't get the password/pass phrase."
1199 * Right you are, Craig!
1201 for (ctl = querylist; ctl; ctl = ctl->next)
1203 memset(ctl->password, '\0', strlen(ctl->password));
1205 #if !defined(HAVE_ATEXIT) && !defined(HAVE_ON_EXIT)
1209 exit(successes ? PS_SUCCESS : querystatus);
1213 * Sequence of protocols to try when autoprobing, most capable to least.
1215 static const int autoprobe[] =
1219 #endif /* IMAP_ENABLE */
1222 #endif /* POP3_ENABLE */
1225 #endif /* POP2_ENABLE */
1228 static int query_host(struct query *ctl)
1229 /* perform fetch transaction with single host */
1233 if (outlevel >= O_VERBOSE)
1238 report(stdout, 0, _("%s querying %s (protocol %s) at %s\n"),
1240 ctl->server.pollname, showproto(ctl->server.protocol), ctime(&now));
1242 switch (ctl->server.protocol) {
1244 for (i = 0; i < sizeof(autoprobe)/sizeof(autoprobe[0]); i++)
1246 ctl->server.protocol = autoprobe[i];
1247 if ((st = query_host(ctl)) == PS_SUCCESS || st == PS_NOMAIL || st == PS_AUTHFAIL || st == PS_LOCKBUSY || st == PS_SMTP)
1250 ctl->server.protocol = P_AUTO;
1255 return(doPOP2(ctl));
1257 report(stderr, 0, _("POP2 support is not configured.\n"));
1258 return(PS_PROTOCOL);
1259 #endif /* POP2_ENABLE */
1265 return(doPOP3(ctl));
1267 report(stderr, 0, _("POP3 support is not configured.\n"));
1268 return(PS_PROTOCOL);
1269 #endif /* POP3_ENABLE */
1277 return(doIMAP(ctl));
1279 report(stderr, 0, _("IMAP support is not configured.\n"));
1280 return(PS_PROTOCOL);
1281 #endif /* IMAP_ENABLE */
1285 report(stderr, 0, _("ETRN support is not configured.\n"));
1286 return(PS_PROTOCOL);
1288 #ifdef HAVE_GETHOSTBYNAME
1289 return(doETRN(ctl));
1291 report(stderr, 0, _("Cannot support ETRN without gethostbyname(2).\n"));
1292 return(PS_PROTOCOL);
1293 #endif /* HAVE_GETHOSTBYNAME */
1294 #endif /* ETRN_ENABLE */
1296 report(stderr, 0, _("unsupported protocol selected.\n"));
1297 return(PS_PROTOCOL);
1301 static void dump_params (struct runctl *runp,
1302 struct query *querylist, flag implicit)
1303 /* display query parameters in English */
1307 if (runp->poll_interval)
1308 printf(_("Poll interval is %d seconds\n"), runp->poll_interval);
1310 printf(_("Logfile is %s\n"), runp->logfile);
1311 if (strcmp(runp->idfile, IDFILE_NAME))
1312 printf(_("Idfile is %s\n"), runp->idfile);
1313 #if defined(HAVE_SYSLOG)
1314 if (runp->use_syslog)
1315 printf(_("Progress messages will be logged via syslog\n"));
1317 if (runp->invisible)
1318 printf(_("Fetchmail will masquerade and will not generate Received\n"));
1319 if (runp->postmaster)
1320 printf(_("Fetchmail will forward misaddressed multidrop messages to %s.\n"),
1323 for (ctl = querylist; ctl; ctl = ctl->next)
1325 if (!ctl->active || (implicit && ctl->server.skip))
1328 printf(_("Options for retrieving from %s@%s:\n"),
1329 ctl->remotename, visbuf(ctl->server.pollname));
1331 if (ctl->server.via && (ctl->server.protocol != P_ETRN))
1332 printf(_(" Mail will be retrieved via %s\n"), ctl->server.via);
1334 if (ctl->server.interval)
1335 printf(_(" Poll of this server will occur every %d intervals.\n"),
1336 ctl->server.interval);
1337 if (ctl->server.truename)
1338 printf(_(" True name of server is %s.\n"), ctl->server.truename);
1339 if (ctl->server.skip || outlevel >= O_VERBOSE)
1340 printf(_(" This host %s be queried when no host is specified.\n"),
1341 ctl->server.skip ? _("will not") : _("will"));
1343 * Don't poll for password when there is one or when using the ETRN
1344 * or IMAP-GSS protocol
1346 if (!ctl->password && (ctl->server.protocol != P_ETRN)
1348 && (ctl->server.protocol != P_IMAP_GSS)
1351 printf(_(" Password will be prompted for.\n"));
1352 else if (outlevel >= O_VERBOSE)
1353 if (ctl->server.protocol == P_APOP)
1354 printf(_(" APOP secret = \"%s\".\n"), visbuf(ctl->password));
1355 else if (ctl->server.protocol == P_RPOP)
1356 printf(_(" RPOP id = \"%s\".\n"), visbuf(ctl->password));
1358 printf(_(" Password = \"%s\".\n"), visbuf(ctl->password));
1359 if (ctl->server.protocol == P_POP3
1361 && !strcmp(ctl->server.service, KPOP_PORT)
1363 && ctl->server.port == KPOP_PORT
1365 && (ctl->server.preauthenticate == A_KERBEROS_V4 ||
1366 ctl->server.preauthenticate == A_KERBEROS_V5))
1367 printf(_(" Protocol is KPOP with Kerberos %s authentication"),
1368 ctl->server.preauthenticate == A_KERBEROS_V5 ? "V" : "IV");
1370 printf(_(" Protocol is %s"), showproto(ctl->server.protocol));
1372 if (ctl->server.service)
1373 printf(_(" (using service %s)"), ctl->server.service);
1374 if (ctl->server.netsec)
1375 printf(_(" (using network security options %s)"), ctl->server.netsec);
1377 if (ctl->server.port)
1378 printf(_(" (using port %d)"), ctl->server.port);
1380 else if (outlevel >= O_VERBOSE)
1381 printf(_(" (using default port)"));
1382 if (ctl->server.uidl && (ctl->server.protocol != P_ETRN))
1383 printf(_(" (forcing UIDL use)"));
1386 if (ctl->server.preauthenticate == A_KERBEROS_V4)
1387 printf(_(" Kerberos V4 preauthentication enabled.\n"));
1388 if (ctl->server.preauthenticate == A_KERBEROS_V5)
1389 printf(_(" Kerberos V5 preauthentication enabled.\n"));
1390 if (ctl->server.timeout > 0)
1391 printf(_(" Server nonresponse timeout is %d seconds"), ctl->server.timeout);
1392 if (ctl->server.timeout == CLIENT_TIMEOUT)
1393 printf(_(" (default).\n"));
1397 if (ctl->server.protocol != P_ETRN) {
1398 if (!ctl->mailboxes->id)
1399 printf(_(" Default mailbox selected.\n"));
1404 printf(_(" Selected mailboxes are:"));
1405 for (idp = ctl->mailboxes; idp; idp = idp->next)
1406 printf(" %s", idp->id);
1409 printf(_(" %s messages will be retrieved (--all %s).\n"),
1410 ctl->fetchall ? _("All") : _("Only new"),
1411 ctl->fetchall ? "on" : "off");
1412 printf(_(" Fetched messages %s be kept on the server (--keep %s).\n"),
1413 ctl->keep ? _("will") : _("will not"),
1414 ctl->keep ? "on" : "off");
1415 printf(_(" Old messages %s be flushed before message retrieval (--flush %s).\n"),
1416 ctl->flush ? _("will") : _("will not"),
1417 ctl->flush ? "on" : "off");
1418 printf(_(" Rewrite of server-local addresses is %s (--norewrite %s).\n"),
1419 ctl->rewrite ? _("enabled") : _("disabled"),
1420 ctl->rewrite ? "off" : "on");
1421 printf(_(" Carriage-return stripping is %s (stripcr %s).\n"),
1422 ctl->stripcr ? _("enabled") : _("disabled"),
1423 ctl->stripcr ? "on" : "off");
1424 printf(_(" Carriage-return forcing is %s (forcecr %s).\n"),
1425 ctl->forcecr ? _("enabled") : _("disabled"),
1426 ctl->forcecr ? "on" : "off");
1427 printf(_(" Interpretation of Content-Transfer-Encoding is %s (pass8bits %s).\n"),
1428 ctl->pass8bits ? _("disabled") : _("enabled"),
1429 ctl->pass8bits ? "on" : "off");
1430 printf(_(" MIME decoding is %s (mimedecode %s).\n"),
1431 ctl->mimedecode ? _("enabled") : _("disabled"),
1432 ctl->mimedecode ? "on" : "off");
1433 printf(_(" Nonempty Status lines will be %s (dropstatus %s)\n"),
1434 ctl->dropstatus ? _("discarded") : _("kept"),
1435 ctl->dropstatus ? "on" : "off");
1436 if (NUM_NONZERO(ctl->limit))
1438 if (NUM_NONZERO(ctl->limit))
1439 printf(_(" Message size limit is %d octets (--limit %d).\n"),
1440 ctl->limit, ctl->limit);
1441 else if (outlevel >= O_VERBOSE)
1442 printf(_(" No message size limit (--limit 0).\n"));
1443 if (run.poll_interval > 0)
1444 printf(_(" Message size warning interval is %d seconds (--warnings %d).\n"),
1445 ctl->warnings, ctl->warnings);
1446 else if (outlevel >= O_VERBOSE)
1447 printf(_(" Size warnings on every poll (--warnings 0).\n"));
1449 if (NUM_NONZERO(ctl->fetchlimit))
1450 printf(_(" Received-message limit is %d (--fetchlimit %d).\n"),
1451 ctl->fetchlimit, ctl->fetchlimit);
1452 else if (outlevel >= O_VERBOSE)
1453 printf(_(" No received-message limit (--fetchlimit 0).\n"));
1454 if (NUM_NONZERO(ctl->batchlimit))
1455 printf(_(" SMTP message batch limit is %d.\n"), ctl->batchlimit);
1456 else if (outlevel >= O_VERBOSE)
1457 printf(_(" No SMTP message batch limit (--batchlimit 0).\n"));
1458 if (ctl->server.protocol == P_IMAP)
1459 if (NUM_NONZERO(ctl->expunge))
1460 printf(_(" Deletion interval between expunges is %d (--expunge %d).\n"), ctl->expunge, ctl->expunge);
1461 else if (outlevel >= O_VERBOSE)
1462 printf(_(" No expunges (--expunge 0).\n"));
1465 printf(_(" Messages will be appended to %s as BSMTP\n"), visbuf(ctl->bsmtp));
1466 else if (ctl->mda && (ctl->server.protocol != P_ETRN))
1467 printf(_(" Messages will be delivered with \"%s\".\n"), visbuf(ctl->mda));
1472 printf(_(" Messages will be %cMTP-forwarded to:"), ctl->listener);
1473 for (idp = ctl->smtphunt; idp; idp = idp->next)
1475 printf(" %s", idp->id);
1476 if (!idp->val.status.mark)
1477 printf(_(" (default)"));
1480 if (ctl->smtpaddress)
1481 printf(_(" Host part of MAIL FROM line will be %s\n"),
1484 if (ctl->server.protocol != P_ETRN)
1486 if (ctl->antispam != (struct idlist *)NULL)
1490 printf(_(" Recognized listener spam block responses are:"));
1491 for (idp = ctl->antispam; idp; idp = idp->next)
1492 printf(" %d", idp->val.status.num);
1495 else if (outlevel >= O_VERBOSE)
1496 printf(_(" Spam-blocking disabled\n"));
1498 if (ctl->preconnect)
1499 printf(_(" Server connection will be brought up with \"%s\".\n"),
1500 visbuf(ctl->preconnect));
1501 else if (outlevel >= O_VERBOSE)
1502 printf(_(" No pre-connection command.\n"));
1503 if (ctl->postconnect)
1504 printf(_(" Server connection will be taken down with \"%s\".\n"),
1505 visbuf(ctl->postconnect));
1506 else if (outlevel >= O_VERBOSE)
1507 printf(_(" No post-connection command.\n"));
1508 if (ctl->server.protocol != P_ETRN) {
1509 if (!ctl->localnames)
1510 printf(_(" No localnames declared for this host.\n"));
1516 for (idp = ctl->localnames; idp; idp = idp->next)
1519 if (count > 1 || ctl->wildcard)
1520 printf(_(" Multi-drop mode: "));
1522 printf(_(" Single-drop mode: "));
1524 printf(_("%d local name(s) recognized.\n"), count);
1525 if (outlevel >= O_VERBOSE)
1527 for (idp = ctl->localnames; idp; idp = idp->next)
1529 printf("\t%s -> %s\n", idp->id, idp->val.id2);
1531 printf("\t%s\n", idp->id);
1533 fputs("\t*\n", stdout);
1536 if (count > 1 || ctl->wildcard)
1538 printf(_(" DNS lookup for multidrop addresses is %s.\n"),
1539 ctl->server.dns ? _("enabled") : _("disabled"));
1540 if (ctl->server.dns)
1542 printf(_(" Server aliases will be compared with multidrop addresses by "));
1543 if (ctl->server.checkalias)
1544 printf(_("IP address.\n"));
1546 printf(_("name.\n"));
1548 if (ctl->server.envelope == STRING_DISABLED)
1549 printf(_(" Envelope-address routing is disabled\n"));
1552 printf(_(" Envelope header is assumed to be: %s\n"),
1553 ctl->server.envelope ? ctl->server.envelope:_("Received"));
1554 if (ctl->server.envskip > 1 || outlevel >= O_VERBOSE)
1555 printf(_(" Number of envelope header to be parsed: %d\n"),
1556 ctl->server.envskip);
1557 if (ctl->server.qvirtual)
1558 printf(_(" Prefix %s will be removed from user id\n"),
1559 ctl->server.qvirtual);
1560 else if (outlevel >= O_VERBOSE)
1561 printf(_(" No prefix stripping\n"));
1564 if (ctl->server.akalist)
1568 printf(_(" Predeclared mailserver aliases:"));
1569 for (idp = ctl->server.akalist; idp; idp = idp->next)
1570 printf(" %s", idp->id);
1573 if (ctl->server.localdomains)
1577 printf(_(" Local domains:"));
1578 for (idp = ctl->server.localdomains; idp; idp = idp->next)
1579 printf(" %s", idp->id);
1586 if (ctl->server.interface)
1587 printf(_(" Connection must be through interface %s.\n"), ctl->server.interface);
1588 else if (outlevel >= O_VERBOSE)
1589 printf(_(" No interface requirement specified.\n"));
1590 if (ctl->server.monitor)
1591 printf(_(" Polling loop will monitor %s.\n"), ctl->server.monitor);
1592 else if (outlevel >= O_VERBOSE)
1593 printf(_(" No monitor interface specified.\n"));
1596 if (ctl->server.plugin)
1597 printf(_(" Server connections will be mode via plugin %s (--plugin %s).\n"), ctl->server.plugin, ctl->server.plugin);
1598 else if (outlevel >= O_VERBOSE)
1599 printf(_(" No plugin command specified.\n"));
1600 if (ctl->server.plugout)
1601 printf(_(" Listener connections will be mode via plugout %s (--plugout %s).\n"), ctl->server.plugout, ctl->server.plugout);
1602 else if (outlevel >= O_VERBOSE)
1603 printf(_(" No plugout command specified.\n"));
1605 if (ctl->server.protocol > P_POP2 && (ctl->server.protocol != P_ETRN))
1607 printf(_(" No UIDs saved from this host.\n"));
1613 for (idp = ctl->oldsaved; idp; idp = idp->next)
1616 printf(_(" %d UIDs saved.\n"), count);
1617 if (outlevel >= O_VERBOSE)
1618 for (idp = ctl->oldsaved; idp; idp = idp->next)
1619 printf("\t%s\n", idp->id);
1622 if (ctl->properties)
1623 printf(_(" Pass-through properties \"%s\".\n"),
1624 visbuf(ctl->properties));
1628 /* fetchmail.c ends here */