aboutsummaryrefslogtreecommitdiffstats
path: root/fetchmail.c
diff options
context:
space:
mode:
Diffstat (limited to 'fetchmail.c')
-rw-r--r--fetchmail.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/fetchmail.c b/fetchmail.c
index be0818b9..e38273fe 100644
--- a/fetchmail.c
+++ b/fetchmail.c
@@ -34,6 +34,10 @@
#include <netdb.h>
#endif /* HAVE_GETHOSTBYNAME */
+#ifdef HESIOD
+#include <hesiod.h>
+#endif
+
#include "fetchmail.h"
#include "tunable.h"
#include "smtp.h"
@@ -966,6 +970,26 @@ static int load_params(int argc, char **argv, int optind)
else
ctl->server.queryname = xstrdup(ctl->server.pollname);
+#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 {
+ error(0, errno, "couldn't find HESIOD pobox for %s",
+ ctl->remotename);
+ }
+ }
+#endif /* HESIOD */
+
/*
* We may have to canonicalize the server truename for later use.
* Do this just once for each lead server, if necessary, in order