diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-12-14 15:34:26 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-12-14 15:34:26 +0000 |
commit | 65487dc2b4af38e3443ec74a020c7b2b0ed703df (patch) | |
tree | 593b129f3200c93442bfef75a9f32bac0dd1a3aa | |
parent | 3606dd6890c19b22b3eb1e5d08d6b456432b8a42 (diff) | |
download | fetchmail-65487dc2b4af38e3443ec74a020c7b2b0ed703df.tar.gz fetchmail-65487dc2b4af38e3443ec74a020c7b2b0ed703df.tar.bz2 fetchmail-65487dc2b4af38e3443ec74a020c7b2b0ed703df.zip |
Search on both pollnames and via names.
svn path=/trunk/; revision=2270
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | driver.c | 2 | ||||
-rw-r--r-- | fetchmail.c | 17 | ||||
-rw-r--r-- | fetchmail.man | 3 |
4 files changed, 19 insertions, 4 deletions
@@ -7,6 +7,7 @@ fetchmail-4.7.0 (): * Unwedge connections on wakeup. * Fix Ken Estes's LMTP coredump error. * Bounce mail with addresses rejected by the listener back to the sender. +* Search .netrc on via name as well as poll name (thanks to Rob Funk). There are 243 people on fetchmail-friends and 322 on fetchmail-announce. @@ -2046,6 +2046,7 @@ const struct method *proto; /* protocol method table */ } no_error: + /* ordinary termination with no errors -- officially log out */ ok = (protocol->logout_cmd)(sock, ctl); /* * Hmmmm...arguably this would be incorrect if we had fetches but @@ -2057,6 +2058,7 @@ const struct method *proto; /* protocol method table */ goto closeUp; cleanUp: + /* we only get here on error */ if (ok != 0 && ok != PS_SOCKET) (protocol->logout_cmd)(sock, ctl); SockClose(sock); diff --git a/fetchmail.c b/fetchmail.c index f037d400..66f5043b 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -395,14 +395,25 @@ int main (int argc, char **argv) ctl->password = ctl->remotename; else { - /* look up the host and account in the .netrc file. */ - netrc_entry *p = search_netrc(netrc_list,ctl->server.pollname); + netrc_entry *p; + + /* look up the pollname and account in the .netrc file. */ + p = search_netrc(netrc_list, ctl->server.pollname); while (p && strcmp(p->account, ctl->remotename)) p = search_netrc(p->next, ctl->remotename); - /* if we find a matching entry with a password, use it */ if (p && p->password) ctl->password = xstrdup(p->password); + + /* otherwise try with "via" name if there is one */ + else if (ctl->server.via) + { + p = search_netrc(netrc_list, ctl->server.via); + while (p && strcmp(p->account, ctl->remotename)) + p = search_netrc(p->next, ctl->remotename); + if (p && p->password) + ctl->password = xstrdup(p->password); + } } if (ctl->server.protocol != P_ETRN && ctl->server.protocol != P_IMAP_K4 diff --git a/fetchmail.man b/fetchmail.man index 92218dc3..c84c7d0c 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -562,7 +562,8 @@ file, it will look for a .I .netrc file in your home directory before requesting one interactively; if an entry matching the mailserver is found in that file, the password will -be used. See the +be used. Fetchmail first looks for a match on poll name; if it finds none, +it checks for a match on via name. See the .IR ftp (1) man page for details of the syntax of the .I .netrc |