X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=fetchmail.c;h=021a1af00a409c43e06c85c87fbdf9daea136bd3;hb=40fe452223b5cc0ff5dbae0efa8551d7e96c1a5c;hp=c99468f868b0f33deb89185585c973b2fce4ebda;hpb=ddfc9c15add2667259484616540a2cd36da9e4c9;p=~andy%2Ffetchmail diff --git a/fetchmail.c b/fetchmail.c index c99468f8..021a1af0 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -133,8 +133,8 @@ static void printcopyright(FILE *fp) { fprintf(fp, GT_("Copyright (C) 2002, 2003 Eric S. Raymond\n" "Copyright (C) 2004 Matthias Andree, Eric S. Raymond,\n" " Robert M. Funk, Graham Wilson\n" - "Copyright (C) 2005 - 2006, 2010 Sunil Shetye\n" - "Copyright (C) 2005 - 2010 Matthias Andree\n" + "Copyright (C) 2005 - 2006, 2010 - 2012 Sunil Shetye\n" + "Copyright (C) 2005 - 2012 Matthias Andree\n" )); fprintf(fp, GT_("Fetchmail comes with ABSOLUTELY NO WARRANTY. This is free software, and you\n" "are welcome to redistribute it under certain conditions. For details,\n" @@ -427,6 +427,8 @@ int main(int argc, char **argv) { int bkgd = FALSE; int implicitmode = FALSE; + flag safewithbg = FALSE; /** if parsed options are compatible with a + fetchmail copy running in the background */ struct query *ctl; netrc_entry *netrc_list; char *netrc_file, *tmpbuf; @@ -470,7 +472,7 @@ int main(int argc, char **argv) #define IDFILE_NAME ".fetchids" run.idfile = prependdir (IDFILE_NAME, fmhome); - + outlevel = O_NORMAL; /* @@ -494,7 +496,7 @@ int main(int argc, char **argv) { int i; - i = parsecmdline(argc, argv, &cmd_run, &cmd_opts); + i = parsecmdline(argc, argv, &cmd_run, &cmd_opts, &safewithbg); if (i < 0) exit(PS_SYNTAX); @@ -759,17 +761,23 @@ int main(int argc, char **argv) else if (getpid() == pid) /* this test enables re-execing on a changed rcfile */ fm_lock_assert(); - else if (argc > 1) + else if (argc > 1 && !safewithbg) { fprintf(stderr, GT_("fetchmail: can't accept options while a background fetchmail is running.\n")); + { + int i; + fprintf(stderr, "argc = %d, arg list:\n", argc); + for (i = 1; i < argc; i++) fprintf(stderr, "arg %d = \"%s\"\n", i, argv[i]); + } return(PS_EXCLUDE); } else if (kill(pid, SIGUSR1) == 0) { - fprintf(stderr, - GT_("fetchmail: background fetchmail at %ld awakened.\n"), - (long)pid); + if (outlevel > O_SILENT) + fprintf(stderr, + GT_("fetchmail: background fetchmail at %ld awakened.\n"), + (long)pid); return(0); } else @@ -1226,7 +1234,6 @@ static void optmerge(struct query *h2, struct query *h1, int force) FLAG_MERGE(server.skip); FLAG_MERGE(server.dns); FLAG_MERGE(server.checkalias); - FLAG_MERGE(server.uidl); FLAG_MERGE(server.principal); #ifdef CAN_MONITOR @@ -1590,7 +1597,6 @@ static int load_params(int argc, char **argv, int optind) DEFAULT(ctl->mimedecode, FALSE); DEFAULT(ctl->idle, FALSE); DEFAULT(ctl->server.dns, TRUE); - DEFAULT(ctl->server.uidl, FALSE); DEFAULT(ctl->use_ssl, FALSE); DEFAULT(ctl->sslcertck, FALSE); DEFAULT(ctl->server.checkalias, FALSE); @@ -1809,7 +1815,6 @@ static int query_host(struct query *ctl) ctl->server.protocol = P_AUTO; break; case P_POP3: - case P_APOP: #ifdef POP3_ENABLE do { st = doPOP3(ctl); @@ -1933,12 +1938,8 @@ static void dump_params (struct runctl *runp, printf(GT_(" Password will be prompted for.\n")); else if (outlevel >= O_VERBOSE) { - if (ctl->server.protocol == P_APOP) - printf(GT_(" APOP secret = \"%s\".\n"), - visbuf(ctl->password)); - else - printf(GT_(" Password = \"%s\".\n"), - visbuf(ctl->password)); + printf(GT_(" Password = \"%s\".\n"), + visbuf(ctl->password)); } } @@ -1953,8 +1954,6 @@ static void dump_params (struct runctl *runp, printf(GT_(" (using service %s)"), ctl->server.service); else if (outlevel >= O_VERBOSE) printf(GT_(" (using default port)")); - if (ctl->server.uidl && MAILBOX_PROTOCOL(ctl)) - printf(GT_(" (forcing UIDL use)")); putchar('.'); putchar('\n'); switch (ctl->server.authenticate) @@ -1986,6 +1985,11 @@ static void dump_params (struct runctl *runp, case A_SSH: printf(GT_(" End-to-end encryption assumed.\n")); break; + case A_APOP: + printf(GT_(" APOP authentication will be forced.\n")); + break; + default: + abort(); } if (ctl->server.principal != (char *) NULL) printf(GT_(" Mail service principal is: %s\n"), ctl->server.principal);