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 /fetchmail.c | |
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
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 17 |
1 files changed, 14 insertions, 3 deletions
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 |