aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-19 20:49:47 +0000
committerEric S. Raymond <esr@thyrsus.com>2001-02-19 20:49:47 +0000
commita910746d015dc74aa702eaffe13e98a496e0a1cc (patch)
tree5065a593d25def8eb9a67e4fcb4c2d18d40894ee
parentea8294a37ef78608fc3b50c8363e64d93d2d491d (diff)
downloadfetchmail-a910746d015dc74aa702eaffe13e98a496e0a1cc.tar.gz
fetchmail-a910746d015dc74aa702eaffe13e98a496e0a1cc.tar.bz2
fetchmail-a910746d015dc74aa702eaffe13e98a496e0a1cc.zip
Abstract out the needs-password check.
svn path=/trunk/; revision=3122
-rw-r--r--fetchmail.c6
-rw-r--r--fetchmail.h3
2 files changed, 5 insertions, 4 deletions
diff --git a/fetchmail.c b/fetchmail.c
index ac6d99e0..6e1d6756 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -324,7 +324,7 @@ int main(int argc, char **argv)
{
if (ctl->active && !(implicitmode && ctl->server.skip)&&!ctl->password)
{
- if (ctl->server.authenticate > A_PASSWORD || ctl->server.protocol >= P_ETRN)
+ if (NO_PASSWORD(ctl))
/* Server won't care what the password is, but there
must be some non-null string here. */
ctl->password = ctl->remotename;
@@ -494,9 +494,7 @@ int main(int argc, char **argv)
for (ctl = querylist; ctl; ctl = ctl->next)
{
if (ctl->active && !(implicitmode && ctl->server.skip)
- && ctl->server.authenticate <= A_PASSWORD
- && ctl->server.protocol < P_ETRN
- && !ctl->password)
+ && !NO_PASSWORD(ctl) && !ctl->password)
{
if (!isatty(0))
{
diff --git a/fetchmail.h b/fetchmail.h
index 9c996c9c..1bbf7db3 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -36,6 +36,9 @@
#define A_GSSAPI 4 /* authenticate with GSSAPI */
#define A_SSH 5 /* authentication at session level */
+/* some protocols (KERBEROS, GSSAPI, SSH) don't require a password */
+#define NO_PASSWORD(ctl) ((ctl)->server.authenticate > A_PASSWORD || (ctl)->server.protocol >= P_ETRN)
+
/*
* Definitions for buffer sizes. We get little help on setting maxima
* from IMAP RFCs up to 2060, so these are mostly from POP3.