aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--driver.c49
-rw-r--r--fetchmail.c38
-rw-r--r--fetchmail.h4
4 files changed, 39 insertions, 53 deletions
diff --git a/NEWS b/NEWS
index ca1bb27c..3bb8520b 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,7 @@
fetchmail-4.0.5 ()
* Increased %o in the Lex source to cope with Ultrix lex.
* RPMs are now built with --without-OPIE to avoid validation problems.
+* Channge in computation of true name to avoid HELO (null) bug.
fetchmail-4.0.4 (Mon Jul 28 23:38:20 EDT 1997)
* Overhauled the build machinery.
diff --git a/driver.c b/driver.c
index 7f627d47..7e013db2 100644
--- a/driver.c
+++ b/driver.c
@@ -140,7 +140,7 @@ static int is_host_alias(const char *name, struct query *ctl)
return(TRUE);
else if (ctl->server.via && strcmp(name, ctl->server.via) == 0)
return(TRUE);
- else if (strcmp(name, ctl->server.canonical_name) == 0)
+ else if (strcmp(name, ctl->server.truename) == 0)
return(TRUE);
else if (!ctl->server.dns)
return(FALSE);
@@ -153,7 +153,7 @@ static int is_host_alias(const char *name, struct query *ctl)
*/
else if ((he = gethostbyname(name)) != (struct hostent *)NULL)
{
- if (strcmp(ctl->server.canonical_name, he->h_name) == 0)
+ if (strcmp(ctl->server.truename, he->h_name) == 0)
goto match;
else
return(FALSE);
@@ -205,7 +205,7 @@ static int is_host_alias(const char *name, struct query *ctl)
else
{
for (mxp = mxrecords; mxp->name; mxp++)
- if (strcmp(ctl->server.canonical_name, mxp->name) == 0)
+ if (strcmp(ctl->server.truename, mxp->name) == 0)
goto match;
return(FALSE);
match:;
@@ -407,41 +407,9 @@ int smtp_open(struct query *ctl)
if ((ctl->smtp_socket = SockOpen(idp->id,SMTP_PORT)) == -1)
continue;
-#ifndef HAVE_RES_SEARCH
- /*
- * How we compute the fake client name to pass to the
- * listener doesn't affect behavior on RFC1123- violating
- * listener that check for name match; we're going to lose
- * on those anyway because we can never give them a name
- * that matches the local machine fetchmail is running on.
- * What it will affect is the listener's logging.
- *
- * If we have the mailserver's canonical FQDN that is clearly
- * the right thing to log. If we don't life is more complicated.
- * The problem is there are two clashing cases:
- *
- * (1) The poll name is a label. In that case we want the
- * log to show the via or true mailserver name.
- *
- * (2) The poll name is the true one, the via name is localhost.
- * This is going to be typical for ssh-using configurations.
- *
- * We're going to assume the via name is true unless it's
- * localhost.
- */
- if (ctrl->server.via && strcmp(ctrl->server.via, "localhost"))
- fakename = ctrl->server.via;
- else
- fakename = ctrl->server->names.id;
-#endif /* HAVE_RES_SEARCH */
-
if (SMTP_ok(ctl->smtp_socket) != SM_OK
|| SMTP_ehlo(ctl->smtp_socket,
-#ifdef HAVE_RES_SEARCH
- ctl->server.canonical_name,
-#else
- fakename,
-#endif /* HAVE_RES_SEARCH */
+ ctl->server.truename,
&ctl->server.esmtp_options) != SM_OK)
{
/*
@@ -464,13 +432,8 @@ int smtp_open(struct query *ctl)
if ((ctl->smtp_socket = SockOpen(idp->id,SMTP_PORT)) == -1)
continue;
else if (SMTP_ok(ctl->smtp_socket) != SM_OK
- || SMTP_helo(ctl->smtp_socket,
-#ifdef HAVE_RES_SEARCH
- ctl->server.canonical_name
-#else
- fakename
-#endif /* HAVE_RES_SEARCH */
- ) != SM_OK)
+ || SMTP_helo(ctl->smtp_socket,
+ ctl->server.truename) != SM_OK)
{
close(ctl->smtp_socket);
ctl->smtp_socket = -1;
diff --git a/fetchmail.c b/fetchmail.c
index 68e8e4dc..04802144 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -356,6 +356,32 @@ int main (int argc, char **argv)
continue;
#endif /* linux */
+ /*
+ * How we compute the true mailhost name to pass to the
+ * listener doesn't affect behavior on RFC1123- violating
+ * listener that check for name match; we're going to lose
+ * on those anyway because we can never give them a name
+ * that matches the local machine fetchmail is running on.
+ * What it will affect is the listener's logging.
+ *
+ * If we have the mailserver's canonical FQDN that is clearly
+ * the right thing to log. If we don't life is more complicated.
+ * The problem is there are two clashing cases:
+ *
+ * (1) The poll name is a label. In that case we want the
+ * log to show the via or true mailserver name.
+ *
+ * (2) The poll name is the true one, the via name is localhost.
+ * This is going to be typical for ssh-using configurations.
+ *
+ * We're going to assume the via name is true unless it's
+ * localhost.
+ */
+ if (ctl->server.via && strcmp(ctl->server.via, "localhost"))
+ ctl->server.truename = xstrdup(ctl->server.via);
+ else
+ ctl->server.truename = xstrdup(ctl->server.names->id);
+
#ifdef HAVE_GETHOSTBYNAME
/*
* This functions partly as an optimization and partly
@@ -368,7 +394,7 @@ int main (int argc, char **argv)
/* compute the canonical name of the host */
errno = 0;
- namerec = gethostbyname(ctl->server.names->id);
+ namerec = gethostbyname(ctl->server.truename);
if (namerec == (struct hostent *)NULL)
{
error(0, errno,
@@ -387,8 +413,8 @@ int main (int argc, char **argv)
}
else
{
- free(ctl->server.canonical_name);
- ctl->server.canonical_name = xstrdup((char *)namerec->h_name);
+ free(ctl->server.truename);
+ ctl->server.truename=xstrdup((char *)namerec->h_name);
}
}
#endif /* HAVE_GETHOSTBYNAME */
@@ -790,10 +816,8 @@ void dump_params (struct query *ctl)
if (ctl->server.interval)
printf(" Poll of this server will occur every %d intervals.\n",
ctl->server.interval);
-#ifdef HAVE_GETHOSTBYNAME
- if (ctl->server.canonical_name)
- printf(" Canonical DNS name of server is %s.\n", ctl->server.canonical_name);
-#endif /* HAVE_GETHOSTBYNAME */
+ if (ctl->server.truename)
+ printf(" True name of server is %s.\n", ctl->server.truename);
if (ctl->server.names->next)
{
struct idlist *idp;
diff --git a/fetchmail.h b/fetchmail.h
index aa3d6474..6062c6c6 100644
--- a/fetchmail.h
+++ b/fetchmail.h
@@ -100,9 +100,7 @@ struct hostdata /* shared among all user connections to given server */
/* computed for internal use */
int poll_count; /* count of polls so far */
-#ifdef HAVE_GETHOSTBYNAME
- char *canonical_name; /* DNS canonical name of server host */
-#endif /* HAVE_GETHOSTBYNAME */
+ char *truename; /* "true name" of server host */
struct hostdata *lead_server; /* ptr to lead query for this server */
int esmtp_options;
};