diff options
-rw-r--r-- | driver.c | 32 | ||||
-rw-r--r-- | etrn.c | 6 | ||||
-rw-r--r-- | fetchmail.c | 31 | ||||
-rw-r--r-- | fetchmail.h | 3 | ||||
-rw-r--r-- | interface.c | 6 | ||||
-rw-r--r-- | rcfile_y.y | 6 | ||||
-rw-r--r-- | uid.c | 4 |
7 files changed, 46 insertions, 42 deletions
@@ -117,18 +117,18 @@ static int is_host_alias(const char *name, struct query *ctl) * The first three checks are optimizations that will catch a good * many cases. * - * (1) check against the poll name the user specified. Odds are + * (1) check against the poll label the user specified. Odds are * good this will either be the mailserver's FQDN or a suffix of * it with the mailserver's domain's default host name omitted. * - * (2) Check the `via' or true host name if present, just in case - * the poll name is a label for one of a couple of different - * configurations and the real server name is here. - * - * (3) Then check the rest of the `also known as' + * (2) Then check the rest of the `also known as' * cache accumulated by previous DNS checks. This cache is primed * by the aka list option. * + * (3) Check the `via' or true host name if present, just in case + * the poll name is a label for one of a couple of different + * configurations and the real server name is here. + * * (4) Finally check against the mailserver's FQDN, in case * it's not the same as the declared hostname. * @@ -136,7 +136,9 @@ static int is_host_alias(const char *name, struct query *ctl) * name doesn't match any 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(&lead_server->names, name)) + if (strcmp(lead_server->pollname, name) == 0) + return(TRUE); + else if (str_in_list(&lead_server->akalist, name)) return(TRUE); else if (ctl->server.via && strcmp(name, ctl->server.via) == 0) return(TRUE); @@ -172,7 +174,7 @@ static int is_host_alias(const char *name, struct query *ctl) putchar('\n'); /* terminate the progress message */ error(0, 0, "nameserver failure while looking for `%s' during poll of %s.", - name, ctl->server.names->id); + name, ctl->server.pollname); ctl->errcount++; break; } @@ -197,7 +199,7 @@ static int is_host_alias(const char *name, struct query *ctl) default: error(0, 0, "nameserver failure while looking for `%s' during poll of %s.", - name, ctl->server.names->id); + name, ctl->server.pollname); ctl->errcount++; break; } @@ -212,7 +214,7 @@ static int is_host_alias(const char *name, struct query *ctl) } /* add this name to relevant server's `also known as' list */ - save_str(&lead_server->names, -1, name); + save_str(&lead_server->akalist, -1, name); return(TRUE); } @@ -1280,7 +1282,7 @@ const struct method *proto; /* protocol method table */ { error(0, 0, "timeout after %d seconds waiting for %s.", - ctl->server.timeout, ctl->server.names->id); + ctl->server.timeout, ctl->server.pollname); if (ctl->smtp_socket != -1) close(ctl->smtp_socket); if (sock != -1) @@ -1305,7 +1307,7 @@ const struct method *proto; /* protocol method table */ /* open a socket to the mail server */ port = ctl->server.port ? ctl->server.port : protocol->port; - realhost = ctl->server.via ? ctl->server.via : ctl->server.names->id; + realhost = ctl->server.via ? ctl->server.via : ctl->server.pollname; if ((sock = SockOpen(realhost, port)) == -1) { #ifndef EHOSTUNREACH @@ -1314,7 +1316,7 @@ const struct method *proto; /* protocol method table */ if (outlevel == O_VERBOSE || errno != EHOSTUNREACH) { error_build("fetchmail: %s connection to %s failed: ", - protocol->name, ctl->server.names->id); + protocol->name, ctl->server.pollname); if (h_errno == HOST_NOT_FOUND) error_complete(0, 0, "host is unknown"); else if (h_errno == NO_ADDRESS) @@ -1422,7 +1424,7 @@ const struct method *proto; /* protocol method table */ *tp = '\0'; } else - strcpy(realname, ctl->server.names->id); + strcpy(realname, ctl->server.pollname); /* try to get authorized to fetch mail */ if (protocol->getauth) @@ -1764,7 +1766,7 @@ const struct method *proto; /* protocol method table */ if (ok==PS_SOCKET || ok==PS_AUTHFAIL || ok==PS_SYNTAX || ok==PS_IOERR || ok==PS_ERROR || ok==PS_PROTOCOL || ok==PS_LOCKBUSY || ok==PS_SMTP) - error(0, -1, "%s error while fetching from %s", msg, ctl->server.names->id); + error(0,-1, "%s error while fetching from %s", msg, ctl->server.pollname); closeUp: signal(SIGALRM, sigsave); @@ -37,16 +37,16 @@ static int etrn_getrange(int sock, struct query *ctl, char *id, int *countp, struct idlist *qnp; /* pointer to Q names */ struct hostent *hp; - if ((ok = SMTP_ehlo(sock, ctl->server.names->id, &opts))) + if ((ok = SMTP_ehlo(sock, ctl->server.truename, &opts))) { error(0, 0, "%s's SMTP listener does not support ESMTP", - ctl->server.names->id); + ctl->server.pollname); return(ok); } else if (!(opts & ESMTP_ETRN)) { error(0, 0, "%s's SMTP listener does not support ETRN", - ctl->server.names->id); + ctl->server.pollname); return(PS_PROTOCOL); } diff --git a/fetchmail.c b/fetchmail.c index 04802144..d2f8c7ed 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -269,7 +269,7 @@ int main (int argc, char **argv) else { /* look up the host and account in the .netrc file. */ - netrc_entry *p = search_netrc(netrc_list,ctl->server.names->id); + netrc_entry *p = search_netrc(netrc_list,ctl->server.pollname); while (p && strcmp(p->account, ctl->remotename)) p = search_netrc(p->next, ctl->remotename); @@ -281,7 +281,7 @@ int main (int argc, char **argv) if (ctl->server.protocol != P_ETRN && ctl->server.protocol != P_IMAP_K4 && !ctl->password) { (void) sprintf(tmpbuf, "Enter password for %s@%s: ", - ctl->remotename, ctl->server.names->id); + ctl->remotename, ctl->server.pollname); ctl->password = xstrdup((char *)getpassword(tmpbuf)); } } @@ -380,7 +380,7 @@ int main (int argc, char **argv) if (ctl->server.via && strcmp(ctl->server.via, "localhost")) ctl->server.truename = xstrdup(ctl->server.via); else - ctl->server.truename = xstrdup(ctl->server.names->id); + ctl->server.truename = xstrdup(ctl->server.pollname); #ifdef HAVE_GETHOSTBYNAME /* @@ -399,7 +399,7 @@ int main (int argc, char **argv) { error(0, errno, "skipping %s poll, ", - ctl->server.names->id); + ctl->server.pollname); if (errno) { if (errno == ENETUNREACH) @@ -552,18 +552,19 @@ static int load_params(int argc, char **argv, int optind) * record from command line and defaults */ for (ctl = querylist; ctl; ctl = ctl->next) - if (str_in_list(&ctl->server.names, argv[optind])) + if (!strcmp(ctl->server.pollname, argv[optind]) + || str_in_list(&ctl->server.akalist, argv[optind])) goto foundit; ctl = hostalloc(&cmd_opts); - save_str(&ctl->server.names, -1, argv[optind]); + ctl->server.pollname = xstrdup(argv[optind]); foundit: ctl->active = TRUE; } /* if there's a defaults record, merge it and lose it */ - if (querylist && strcmp(querylist->server.names->id, "defaults") == 0) + if (querylist && strcmp(querylist->server.pollname, "defaults") == 0) { for (ctl = querylist->next; ctl; ctl = ctl->next) optmerge(ctl, querylist); @@ -572,7 +573,7 @@ static int load_params(int argc, char **argv, int optind) /* don't allow a defaults record after the first */ for (ctl = querylist; ctl; ctl = ctl->next) - if (ctl != querylist && strcmp(ctl->server.names->id, "defaults") == 0) + if (ctl != querylist && strcmp(ctl->server.pollname, "defaults") == 0) exit(PS_SYNTAX); /* merge in wired defaults, do sanity checks and prepare internal fields */ @@ -650,14 +651,14 @@ static int load_params(int argc, char **argv, int optind) { (void) fprintf(stderr, "%s configuration invalid, port number cannot be negative", - ctl->server.names->id); + ctl->server.pollname); exit(PS_SYNTAX); } if (ctl->server.protocol == P_RPOP && ctl->server.port >= 1024) { (void) fprintf(stderr, "%s configuration invalid, RPOP requires a privileged port", - ctl->server.names->id); + ctl->server.pollname); exit(PS_SYNTAX); } } @@ -749,7 +750,7 @@ static int query_host(struct query *ctl) if (outlevel == O_VERBOSE) fprintf(stderr, "fetchmail: interval not reached, not querying %s\n", - ctl->server.names->id); + ctl->server.pollname); return PS_NOMAIL; } } @@ -761,7 +762,7 @@ static int query_host(struct query *ctl) time(&now); fprintf(stderr, "fetchmail: %s querying %s (protocol %s) at %s", RELEASE_ID, - ctl->server.names->id, showproto(ctl->server.protocol), ctime(&now)); + ctl->server.pollname, showproto(ctl->server.protocol), ctime(&now)); } switch (ctl->server.protocol) { case P_AUTO: @@ -808,7 +809,7 @@ void dump_params (struct query *ctl) /* display query parameters in English */ { printf("Options for retrieving from %s@%s:\n", - ctl->remotename, visbuf(ctl->server.names->id)); + ctl->remotename, visbuf(ctl->server.pollname)); if (ctl->server.via) printf(" Mail will be retrieved via %s\n", ctl->server.via); @@ -818,12 +819,12 @@ void dump_params (struct query *ctl) ctl->server.interval); if (ctl->server.truename) printf(" True name of server is %s.\n", ctl->server.truename); - if (ctl->server.names->next) + if (ctl->server.akalist) { struct idlist *idp; printf(" Predeclared mailserver aliases:"); - for (idp = ctl->server.names->next; idp; idp = idp->next) + for (idp = ctl->server.akalist; idp; idp = idp->next) printf(" %s", idp->id); putchar('\n'); } diff --git a/fetchmail.h b/fetchmail.h index 6062c6c6..495ec823 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -78,8 +78,9 @@ typedef char flag; struct hostdata /* shared among all user connections to given server */ { /* rc file data */ + char *pollname; /* poll label of host */ char *via; /* "true" server name if non-NULL */ - struct idlist *names; /* server name first, then akas */ + struct idlist *akalist; /* server name first, then akas */ struct idlist *localdomains; /* list of pass-through domains */ int protocol; /* protocol type */ int port; /* TCP/IP service port number */ diff --git a/interface.c b/interface.c index 295bb3be..b379786b 100644 --- a/interface.c +++ b/interface.c @@ -175,7 +175,7 @@ int interface_approve(struct hostdata *hp) /* get interface info */ if (!get_ifinfo(hp->interface, &ifinfo)) { (void) error(0, 0, "skipping poll of %s, %s down", - hp->names->id, hp->interface); + hp->pollname, hp->interface); return(FALSE); } /* check the IP address (range) */ @@ -184,7 +184,7 @@ int interface_approve(struct hostdata *hp) hp->interface_pair->interface_address.s_addr) { (void) error(0, 0, "skipping poll of %s, %s IP address excluded", - hp->names->id, hp->interface); + hp->pollname, hp->interface); return(FALSE); } } @@ -202,7 +202,7 @@ int interface_approve(struct hostdata *hp) hp->monitor_io == ifinfo.rx_packets + ifinfo.tx_packets) { (void) error(0, 0, "skipping poll of %s, %s inactive", - hp->names->id, hp->monitor); + hp->pollname, hp->monitor); return(FALSE); } @@ -117,8 +117,8 @@ serverspecs : /* EMPTY */ | serverspecs serv_option ; -alias_list : STRING {save_str(¤t.server.names,-1,$1);} - | alias_list STRING {save_str(¤t.server.names,-1,$2);} +alias_list : STRING {save_str(¤t.server.akalist,-1,$1);} + | alias_list STRING {save_str(¤t.server.akalist,-1,$2);} ; domain_list : STRING {save_str(¤t.server.localdomains,-1,$1);} @@ -343,7 +343,7 @@ static int reset_server(char *name, int skip) trailer = FALSE; memset(¤t,'\0',sizeof(current)); current.smtp_socket = -1; - save_str(¤t.server.names, -1, name); + current.server.pollname = xstrdup(name); current.server.skip = skip; return(TRUE); } @@ -82,7 +82,7 @@ void initialize_saved_lists(struct query *hostlist, const char *idfile) { for (ctl = hostlist; ctl; ctl = ctl->next) { - if (strcasecmp(host, ctl->server.names->id) == 0 + if (strcasecmp(host, ctl->server.truename) == 0 && strcasecmp(user, ctl->remotename) == 0) { save_str(&ctl->oldsaved, -1, id); @@ -255,7 +255,7 @@ void write_saved_lists(struct query *hostlist, const char *idfile) for (ctl = hostlist; ctl; ctl = ctl->next) { for (idp = ctl->oldsaved; idp; idp = idp->next) fprintf(tmpfp, "%s@%s %s\n", - ctl->remotename, ctl->server.names->id, idp->id); + ctl->remotename, ctl->server.truename, idp->id); } for (idp = scratchlist; idp; idp = idp->next) fputs(idp->id, tmpfp); |