aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2000-06-07 02:21:36 +0000
committerEric S. Raymond <esr@thyrsus.com>2000-06-07 02:21:36 +0000
commitbdf8ed139a586f3ef1d11574c59813f982ca0698 (patch)
treee0c0bbcae55bffc9a26af0b163677d0ed1692760 /fetchmail.c
parentecc6b895f60f149122eee9a3df2342e4b738fd0e (diff)
downloadfetchmail-bdf8ed139a586f3ef1d11574c59813f982ca0698.tar.gz
fetchmail-bdf8ed139a586f3ef1d11574c59813f982ca0698.tar.bz2
fetchmail-bdf8ed139a586f3ef1d11574c59813f982ca0698.zip
Julian Haight's changes.
svn path=/trunk/; revision=2900
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/fetchmail.c b/fetchmail.c
index bce52ae5..dd83b671 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -831,6 +831,7 @@ static void optmerge(struct query *h2, struct query *h1, int force)
FLAG_MERGE(bsmtp);
FLAG_MERGE(listener);
FLAG_MERGE(smtpaddress);
+ FLAG_MERGE(smtpname);
FLAG_MERGE(preconnect);
FLAG_MERGE(postconnect);
@@ -1143,8 +1144,40 @@ static int load_params(int argc, char **argv, int optind)
ctl->server.truename=xstrdup((char *)namerec->h_name);
}
#endif /* HAVE_GETHOSTBYNAME */
- else
- ctl->server.truename = xstrdup(ctl->server.queryname);
+ else {
+#ifdef HAVE_GETHOSTBYNAME
+ struct hostent *namerec;
+
+ /* <fetchmail@mail.julianhaight.com>
+ Get the host's IP, so we can report it like this:
+
+ Received: from hostname [10.0.0.1]
+
+ do we actually need to gethostbyname to find the IP?
+ it seems like it would be faster to do this later, when
+ we are actually resolving the hostname for a connection,
+ but I ain't that smart, so I don't know where to make
+ the change later..
+ */
+ errno = 0;
+ namerec = gethostbyname(ctl->server.queryname);
+ if (namerec == (struct hostent *)NULL)
+ {
+ report(stderr,
+ _("couldn't find canonical DNS name of %s\n"),
+ ctl->server.pollname);
+ exit(PS_DNS);
+ }
+ else {
+ ctl->server.truename=xstrdup((char *)namerec->h_name);
+ ctl->server.trueaddr=xmalloc(namerec->h_length);
+ memcpy(ctl->server.trueaddr,
+ namerec->h_addr_list[0],
+ namerec->h_length);
+ }
+#endif /* HAVE_GETHOSTBYNAME */
+ ctl->server.truename = xstrdup(ctl->server.queryname);
+ }
/* if no folders were specified, set up the null one as default */
if (!ctl->mailboxes)