diff options
-rw-r--r-- | driver.c | 22 | ||||
-rw-r--r-- | fetchmail.c | 27 | ||||
-rw-r--r-- | fetchmail.man | 2 |
3 files changed, 25 insertions, 26 deletions
@@ -365,24 +365,18 @@ struct query *ctl; /* query control record */ find_server_names(cchdr, ctl, &xmit_names); find_server_names(bcchdr, ctl, &xmit_names); if (!xmit_names) + { no_local_matches = TRUE; + save_uid(&xmit_names, -1, user); + if (outlevel == O_VERBOSE) + fprintf(stderr, + "fetchmail: no local matches, forwarding to %s\n", + user); + } } else /* it's a single-drop box, use first localname */ #endif /* HAVE_RES_SEARCH */ - { - if (ctl->localnames) - save_uid(&xmit_names, -1, ctl->localnames->id); - } - - /* if nothing supplied localnames, default appropriately */ - if (!xmit_names) - { - save_uid(&xmit_names, -1, user); - if (outlevel == O_VERBOSE) - fprintf(stderr, - "fetchmail: no local matches, forwarding to %s\n", - user); - } + save_uid(&xmit_names, -1, ctl->localnames->id); /* time to address the message */ if (ctl->mda[0]) /* we have a declared MDA */ diff --git a/fetchmail.c b/fetchmail.c index eabef1d0..763bfa5a 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -51,10 +51,11 @@ char *idfile; /* UID list file */ int versioninfo; /* emit only version info */ char *user; /* the name of the invoking user */ -static void termhook(); -static char *lockfile; -static int popstatus; -static int lastsig; +static char *lockfile; /* name of lockfile */ +static int querystatus; /* status of query */ +static int lastsig; /* last signal received */ + +static void termhook(); /* forward declaration of exit hook */ RETSIGTYPE donothing(sig) int sig; {signal(sig, donothing); lastsig = sig;} @@ -335,7 +336,7 @@ int main (int argc, char **argv) } #endif /* HAVE_GETHOSTBYNAME */ - popstatus = query_host(ctl); + querystatus = query_host(ctl); if (!check_only) update_uid_lists(ctl); } @@ -402,10 +403,10 @@ int main (int argc, char **argv) (poll_interval); if (outlevel == O_VERBOSE) - fprintf(stderr,"fetchmail: normal termination, status %d\n",popstatus); + fprintf(stderr,"fetchmail: normal termination, status %d\n",querystatus); termhook(0); - exit(popstatus); + exit(querystatus); } static int load_params(int argc, char **argv, int optind) @@ -477,15 +478,19 @@ static int load_params(int argc, char **argv, int optind) exit(PS_SYNTAX); } - /* check that delivery is going to a real local user */ + /* make sure delivery will default to a real local user */ if ((pw = getpwnam(user)) == (struct passwd *)NULL) { fprintf(stderr, - "fetchmail: can't default delivery to %s\n", user); + "fetchmail: can't set up default delivery to %s\n", user); exit(PS_SYNTAX); /* has to be from bad rc file */ } else - ctl->uid = pw->pw_uid; + { + ctl->uid = pw->pw_uid; /* for local delivery via MDA */ + if (!ctl->localnames) /* for local delivery via SMTP */ + save_uid(&ctl->localnames, -1, user); + } #if !defined(HAVE_GETHOSTBYNAME) || !defined(HAVE_RES_SEARCH) /* can't handle multidrop mailboxes unless we can do DNS lookups */ @@ -583,7 +588,7 @@ void termhook(int sig) if (!check_only) write_saved_lists(querylist, idfile); - exit(popstatus); + exit(querystatus); } static char *showproto(int proto) diff --git a/fetchmail.man b/fetchmail.man index 7001fb62..054225ef 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -544,7 +544,7 @@ Here's a version of those two with more whitespace and some noise words: poll pop.provider.net proto pop3 user jsmith, with password secret1, is jsmith here; poll other.provider.net proto pop2: - user John.Smith with password My^Hat, is John.Smith here; + user John.Smith, with password My^Hat, is John.Smith here; .fi This version is much easier to read and doesn't cost significantly |