From 1aa5b7ad191fe589eb7b9bd8256d55c925185a1e Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Mon, 24 Sep 2001 23:31:48 +0000 Subject: Move Hesiod lookups away from startup time. svn path=/trunk/; revision=3484 --- driver.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 9f2a8915..50974746 100644 --- a/driver.c +++ b/driver.c @@ -28,6 +28,9 @@ #ifdef HAVE_NET_SOCKET_H #include #endif +#ifdef HESIOD +#include +#endif #ifdef HAVE_RES_SEARCH #include @@ -806,6 +809,26 @@ const int maxfetch; /* maximum number of messages to fetch */ #endif #endif /* !INET6_ENABLE */ +#ifdef HESIOD + /* If either the pollname or vianame are "hesiod" we want to + lookup the user's hesiod pobox host */ + if (!strcasecmp(ctl->server.queryname, "hesiod")) { + struct hes_postoffice *hes_p; + hes_p = hes_getmailhost(ctl->remotename); + if (hes_p != NULL && strcmp(hes_p->po_type, "POP") == 0) { + free(ctl->server.queryname); + ctl->server.queryname = xstrdup(hes_p->po_host); + if (ctl->server.via) + free(ctl->server.via); + ctl->server.via = xstrdup(hes_p->po_host); + } else { + report(stderr, + GT_("couldn't find HESIOD pobox for %s\n"), + ctl->remotename); + } + } +#endif /* HESIOD */ + #ifdef HAVE_GETHOSTBYNAME /* * Canonicalize the server truename for later use. This also -- cgit v1.2.3