From 48232265f836113745c0534694e65b3c9f8bcfc7 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 6 Aug 1997 05:59:47 +0000 Subject: Fixed Bill Powers's uid bug. svn path=/trunk/; revision=1240 --- fetchmail.c | 51 +++++++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'fetchmail.c') diff --git a/fetchmail.c b/fetchmail.c index dacf254b..bf866a97 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -369,29 +369,6 @@ int main (int argc, char **argv) continue; #endif /* linux */ - /* - * - * Compute the true name of the mailserver host. - * There are two clashing cases here: - * - * (1) The poll name is a label, possibly on one of several - * poll configurations for the same host. In this case - * the `via' option will be present and give the true 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. - * - * Then, if we've got DNS, we'll try to canonicalize the name. - */ - if (ctl->server.via && strcmp(ctl->server.via, "localhost")) - ctl->server.truename = xstrdup(ctl->server.via); - else - ctl->server.truename = xstrdup(ctl->server.pollname); - #ifdef HAVE_GETHOSTBYNAME /* * This functions partly as a probe to make sure our @@ -404,7 +381,7 @@ int main (int argc, char **argv) /* compute the canonical name of the host */ errno = 0; - namerec = gethostbyname(ctl->server.truename); + namerec = gethostbyname(ctl->server.queryname); if (namerec == (struct hostent *)NULL) { error(0, errno, @@ -644,6 +621,32 @@ static int load_params(int argc, char **argv, int optind) DEFAULT(ctl->server.uidl, FALSE); #undef DEFAULT + /* + * + * Compute the true name of the mailserver host. + * There are two clashing cases here: + * + * (1) The poll name is a label, possibly on one of several + * poll configurations for the same host. In this case + * the `via' option will be present and give the true 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. + * + * Each poll cycle, if we've got DNS, we'll try to canonicalize + * the name. This will function as a probe to ensure the + * host's nameserver is up. + */ + if (ctl->server.via && strcmp(ctl->server.via, "localhost")) + ctl->server.queryname = xstrdup(ctl->server.via); + else + ctl->server.queryname = xstrdup(ctl->server.pollname); + ctl->server.truename = xstrdup(ctl->server.queryname); + /* plug in the semi-standard way of indicating a mail address */ if (ctl->server.envelope == (char *)NULL) ctl->server.envelope = "X-Envelope-To:"; -- cgit v1.2.3