aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1998-12-14 15:34:26 +0000
committerEric S. Raymond <esr@thyrsus.com>1998-12-14 15:34:26 +0000
commit65487dc2b4af38e3443ec74a020c7b2b0ed703df (patch)
tree593b129f3200c93442bfef75a9f32bac0dd1a3aa /fetchmail.c
parent3606dd6890c19b22b3eb1e5d08d6b456432b8a42 (diff)
downloadfetchmail-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.c17
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