aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-11-08 22:11:54 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-11-08 22:11:54 +0000
commitddb6ad5e4757c872d8153072fed52de54561c6a6 (patch)
tree37bc4e471d35eff27f039775abb5134bd6893dcb /fetchmail.c
parent62472c27003c5a45d01d35b7e39f7145fa6dda1d (diff)
downloadfetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.tar.gz
fetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.tar.bz2
fetchmail-ddb6ad5e4757c872d8153072fed52de54561c6a6.zip
We no longer attempt delivery to multidrop mailboxes in the presence
of DNS errors. svn path=/trunk/; revision=519
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/fetchmail.c b/fetchmail.c
index 47620dfe..e22568a5 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -307,6 +307,33 @@ int main (int argc, char **argv)
{
if (ctl->active && !(implicitmode && ctl->skip))
{
+#ifdef HAVE_GETHOSTBYNAME
+ /*
+ * This functions partly as an optimization and partly
+ * as a probe to make sure our nameserver is still up.
+ * The multidrop case (especially) needs it.
+ */
+ if (ctl->authenticate == A_KERBEROS || MULTIDROP(ctl))
+ {
+ struct hostent *namerec;
+
+ /* compute the canonical name of the host */
+ namerec = gethostbyname(ctl->servername);
+ if (namerec == (struct hostent *)NULL)
+ {
+ fprintf(stderr,
+ "fetchmail: skipping %s poll, nameserver isn't responding\n",
+ ctl->servername);
+ continue;
+ }
+ else
+ {
+ free(ctl->canonical_name);
+ ctl->canonical_name = xstrdup((char *)namerec->h_name);
+ }
+ }
+#endif /* HAVE_GETHOSTBYNAME */
+
popstatus = query_host(ctl);
if (!check_only)
update_uid_lists(ctl);
@@ -439,10 +466,6 @@ static int load_params(int argc, char **argv, int optind)
{
if (ctl->active && !(implicitmode && ctl->skip))
{
-#ifdef HAVE_GETHOSTBYNAME
- struct hostent *namerec;
-#endif /* HAVE_GETHOSTBYNAME */
-
/* merge in defaults */
optmerge(ctl, &def_opts);
@@ -463,29 +486,6 @@ static int load_params(int argc, char **argv, int optind)
else
ctl->uid = pw->pw_uid;
-#ifdef HAVE_GETHOSTBYNAME
- /*
- * Don't do DNS lookup unless we need to because we're going
- * to use Kerberos or process a multidrop box. Some sites
- * won't have DNS up at fetchmail initialization time but aren't
- * using these features -- avoid hosing them unnecessarily.
- */
- if (ctl->authenticate == A_KERBEROS || MULTIDROP(ctl))
- {
- /* compute the canonical name of the host */
- namerec = gethostbyname(ctl->servername);
- if (namerec == (struct hostent *)NULL)
- {
- fprintf(stderr,
- "fetchmail: can't get canonical name of host %s\n",
- ctl->servername);
- exit(PS_SYNTAX);
- }
- else
- ctl->canonical_name = xstrdup((char *)namerec->h_name);
- }
-#endif /* HAVE_GETHOSTBYNAME */
-
#if !defined(HAVE_GETHOSTBYNAME) || !defined(HAVE_RES_SEARCH)
/* can't handle multidrop mailboxes unless we can do DNS lookups */
if (ctl->localnames && ctl->localnames->next)