aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-03-14 01:13:22 +0000
committerEric S. Raymond <esr@thyrsus.com>2001-03-14 01:13:22 +0000
commit396d240a4311dc264e1276866307672205f021a6 (patch)
tree2ef012f674be2051cb0239c03a78e1e6954fb105 /fetchmail.c
parent6a073d7f236af8b18a5ce7e0a3075422028f6965 (diff)
downloadfetchmail-396d240a4311dc264e1276866307672205f021a6.tar.gz
fetchmail-396d240a4311dc264e1276866307672205f021a6.tar.bz2
fetchmail-396d240a4311dc264e1276866307672205f021a6.zip
Cut down on the number of DNS queries at startup.
svn path=/trunk/; revision=3255
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c44
1 files changed, 25 insertions, 19 deletions
diff --git a/fetchmail.c b/fetchmail.c
index cac7b413..a62103d1 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -976,6 +976,30 @@ static int load_params(int argc, char **argv, int optind)
if (check_only && run.poll_interval)
run.poll_interval = 0;
+ /*
+ * DNS support is required for some protocols. We used to
+ * do this unconditionally, but it made fetchmail excessively
+ * vulnerable to misconfigured DNS setups.
+ *
+ * If we're using ETRN or ODMR, the smtp hunt list is the
+ * list of systems we're polling on behalf of; these have
+ * to be fully-qualified domain names. The default for
+ * this list should be the FQDN of localhost.
+ *
+ * If we're using Kerberos for authentication, we need
+ * the FQDN in order to generate capability keys.
+ */
+ if (strcmp(fetchmailhost, "localhost") == 0)
+ for (ctl = querylist; ctl; ctl = ctl->next)
+ if (ctl->active &&
+ (ctl->server.protocol==P_ETRN || ctl->server.protocol==P_ODMR
+ || ctl->server.authenticate == A_KERBEROS_V4
+ || ctl->server.authenticate == A_KERBEROS_V5))
+ {
+ fetchmailhost = host_fqdn();
+ break;
+ }
+
/* merge in wired defaults, do sanity checks and prepare internal fields */
for (ctl = querylist; ctl; ctl = ctl->next)
{
@@ -1016,24 +1040,6 @@ static int load_params(int argc, char **argv, int optind)
#undef DEFAULT
/*
- * DNS support is required for some protocols. We used to
- * do this unconditionally, but it made fetchmail excessively
- * vulnerable to misconfigured DNS setups.
- *
- * If we're using ETRN or ODMR, the smtp hunt list is the
- * list of systems we're polling on behalf of; these have
- * to be fully-qualified domain names. The default for
- * this list should be the FQDN of localhost.
- *
- * If we're using Kerberos for authentication, we need
- * the FQDN in order to generate capability keys. */
- if (ctl->server.protocol==P_ETRN || ctl->server.protocol==P_ODMR
- || ctl->server.authenticate == A_KERBEROS_V4
- || ctl->server.authenticate == A_KERBEROS_V5)
- if (strcmp(fetchmailhost, "localhost") == 0)
- fetchmailhost = host_fqdn();
-
- /*
* Make sure we have a nonempty host list to forward to.
*/
if (!ctl->smtphunt)
@@ -1117,7 +1123,7 @@ static int load_params(int argc, char **argv, int optind)
ctl->server.truename = xstrdup(leadname);
}
#ifdef HAVE_GETHOSTBYNAME
- else if (!configdump)
+ else if (ctl->active && !configdump)
{
if (ctl->server.authenticate==A_KERBEROS_V4 ||
ctl->server.authenticate==A_KERBEROS_V5 ||