diff options
-rw-r--r-- | driver.c | 12 | ||||
-rw-r--r-- | fetchmail.c | 12 | ||||
-rw-r--r-- | fetchmail.h | 11 |
3 files changed, 19 insertions, 16 deletions
@@ -130,9 +130,9 @@ static int is_host_alias(const char *name, struct query *ctl) * name doesn't match either is it time to call the bind library. * If this happens odds are good we're looking at an MX name. */ - if (str_in_list(&ctl->lead_server->server.names, name)) + if (str_in_list(&ctl->server.lead_server->names, name)) return(TRUE); - else if (strcmp(name, ctl->canonical_name) == 0) + else if (strcmp(name, ctl->server.canonical_name) == 0) return(TRUE); /* @@ -143,7 +143,7 @@ static int is_host_alias(const char *name, struct query *ctl) */ else if ((he = gethostbyname(name)) != (struct hostent *)NULL) { - if (strcmp(ctl->canonical_name, he->h_name) == 0) + if (strcmp(ctl->server.canonical_name, he->h_name) == 0) goto match; else return(FALSE); @@ -197,14 +197,14 @@ static int is_host_alias(const char *name, struct query *ctl) else { for (mxp = mxrecords; mxp->name; mxp++) - if (strcmp(ctl->canonical_name, mxp->name) == 0) + if (strcmp(ctl->server.canonical_name, mxp->name) == 0) goto match; return(FALSE); match:; } /* add this name to relevant server's `also known as' list */ - save_str(&ctl->lead_server->server.names, -1, name); + save_str(&ctl->server.lead_server->names, -1, name); return(TRUE); } @@ -947,7 +947,7 @@ const struct method *proto; /* protocol method table */ #ifdef KERBEROS_V4 if (ctl->authenticate == A_KERBEROS) { - ok = kerberos_auth(fileno(sockfp), ctl->canonical_name); + ok = kerberos_auth(fileno(sockfp), ctl->server.canonical_name); if (ok != 0) goto cleanUp; vtalarm(ctl->server.timeout); diff --git a/fetchmail.c b/fetchmail.c index c2169bfc..7a1ed4d7 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -480,8 +480,8 @@ int main (int argc, char **argv) } else { - free(ctl->canonical_name); - ctl->canonical_name = xstrdup((char *)namerec->h_name); + free(ctl->server.canonical_name); + ctl->server.canonical_name = xstrdup((char *)namerec->h_name); } } #endif /* HAVE_GETHOSTBYNAME */ @@ -642,10 +642,10 @@ static int load_params(int argc, char **argv, int optind) for (mp = querylist; mp && mp != ctl; mp = mp->next) if (strcmp(mp->server.names->id, ctl->server.names->id) == 0) { - ctl->lead_server = mp->lead_server; + ctl->server.lead_server = mp->server.lead_server; goto no_new_server; } - ctl->lead_server = ctl; + ctl->server.lead_server = &(ctl->server); no_new_server:; /* plug in the semi-standard way of indicating a mail address */ @@ -799,8 +799,8 @@ void dump_params (struct query *ctl) printf("Options for retrieving from %s@%s:\n", ctl->remotename, visbuf(ctl->server.names->id)); #ifdef HAVE_GETHOSTBYNAME - if (ctl->canonical_name) - printf(" Canonical DNS name of server is %s.\n", ctl->canonical_name); + if (ctl->server.canonical_name) + printf(" Canonical DNS name of server is %s.\n", ctl->server.canonical_name); #endif /* HAVE_GETHOSTBYNAME */ if (ctl->server.names->next) { diff --git a/fetchmail.h b/fetchmail.h index 56b146b1..5145ed6d 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -62,6 +62,7 @@ struct idlist struct hostdata /* shared among all user connections to given server */ { + /* rc file data */ struct idlist *names; /* server name first, then akas */ struct idlist *localdomains; /* list of pass-through domains */ int protocol; @@ -70,6 +71,12 @@ struct hostdata /* shared among all user connections to given server */ int timeout; char *envelope; int skip; + + /* computed for internal use */ +#ifdef HAVE_GETHOSTBYNAME + char *canonical_name; /* DNS canonical name of server host */ +#endif /* HAVE_GETHOSTBYNAME */ + struct hostdata *lead_server; /* ptr to lead query for this server */ }; struct query @@ -104,12 +111,8 @@ struct query struct query *next; /* next query control block in chain */ struct query *lead_smtp; /* pointer to this query's SMTP leader */ FILE *smtp_sockfp; /* socket descriptor for SMTP connection */ - struct query *lead_server; /* pointer to lead query for this server */ unsigned int uid; /* UID of user to deliver to */ char digest [DIGESTLEN]; /* md5 digest buffer */ -#ifdef HAVE_GETHOSTBYNAME - char *canonical_name; /* DNS canonical name of server host */ -#endif /* HAVE_GETHOSTBYNAME */ }; #define MULTIDROP(ctl) (ctl->wildcard || \ |