X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=checkalias.c;h=1e1d16339fe033fc082154c494d78f15b830e512;hb=49268a95ee78bc179fd3439b3f06e9a06c993c92;hp=80356ed292a5f6dca37d3e94d14f7c1e8d3d9444;hpb=df4a264f6a4bf53592f9e273462a8861ea7e6a6d;p=~andy%2Ffetchmail diff --git a/checkalias.c b/checkalias.c index 80356ed2..1e1d1633 100644 --- a/checkalias.c +++ b/checkalias.c @@ -28,6 +28,7 @@ typedef unsigned char address_t[sizeof (struct in_addr)]; +#ifdef HAVE_RES_SEARCH static int getaddresses(struct addrinfo **result, const char *name) { struct addrinfo hints; @@ -82,15 +83,18 @@ found: fm_freeaddrinfo(res1); return rc; } +#endif int is_host_alias(const char *name, struct query *ctl, struct addrinfo **res) /* determine whether name is a DNS alias of the mailserver for this query */ { +#ifdef HAVE_RES_SEARCH struct mxentry *mxp, *mxrecords; - struct idlist *idl; - size_t namelen; int e; struct addrinfo hints, *res_st; +#endif + struct idlist *idl; + size_t namelen; struct hostdata *lead_server = ctl->server.lead_server ? ctl->server.lead_server : &ctl->server; @@ -125,7 +129,7 @@ int is_host_alias(const char *name, struct query *ctl, struct addrinfo **res) namelen = strlen(name); for (idl = lead_server->akalist; idl; idl = idl->next) { - char *ep; + const char *ep; /* * Test is >= here because str_in_list() should have caught the @@ -134,7 +138,7 @@ int is_host_alias(const char *name, struct query *ctl, struct addrinfo **res) */ if (strlen(idl->id) >= namelen) continue; - ep = (char *)name + (namelen - strlen(idl->id)); + ep = name + (namelen - strlen(idl->id)); /* a suffix led by . must match */ if (ep[-1] == '.' && !strcasecmp(ep, idl->id)) return(TRUE); @@ -143,6 +147,7 @@ int is_host_alias(const char *name, struct query *ctl, struct addrinfo **res) if (!ctl->server.dns) return(FALSE); #ifndef HAVE_RES_SEARCH + (void)res; return(FALSE); #else /* @@ -189,6 +194,15 @@ int is_host_alias(const char *name, struct query *ctl, struct addrinfo **res) switch (e) { case EAI_NONAME: /* specified host is unknown */ +#ifdef EAI_NODATA + /* EAI_NODATA was in the older RFC-2553, but that got + * obsoleted by RFC-3493 - there, EAI_NODATA is no longer + * valid, and modern operating systems no longer issue this + * error code. libesmtp/getaddrinfo.?, however, still does. + * (This was reported to Brian Stafford 2013-02-03.) + */ + case EAI_NODATA: /* specified host is unknown */ +#endif break; default: