diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-10-26 03:01:11 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-10-26 03:01:11 +0000 |
commit | 24c90ce22d39bab628f6b84b2ebbacd01b9f784e (patch) | |
tree | 1e650d21ed85ee0eb7750efbdcf3127e24581da6 | |
parent | 74631396d18f4c5b025e9cbbb70d0103c783037e (diff) | |
download | fetchmail-24c90ce22d39bab628f6b84b2ebbacd01b9f784e.tar.gz fetchmail-24c90ce22d39bab628f6b84b2ebbacd01b9f784e.tar.bz2 fetchmail-24c90ce22d39bab628f6b84b2ebbacd01b9f784e.zip |
Major changes of data structure and variable names.
svn path=/trunk/; revision=391
-rw-r--r-- | driver.c | 128 | ||||
-rw-r--r-- | fetchmail.c | 212 | ||||
-rw-r--r-- | fetchmail.h | 50 | ||||
-rw-r--r-- | imap.c | 30 | ||||
-rw-r--r-- | options.c | 48 | ||||
-rw-r--r-- | pop2.c | 26 | ||||
-rw-r--r-- | pop3.c | 54 | ||||
-rw-r--r-- | rcfile_y.y | 28 | ||||
-rw-r--r-- | uid.c | 12 |
9 files changed, 295 insertions, 293 deletions
@@ -328,10 +328,10 @@ char *hdr; /* header line to be parsed, NUL to continue in previous hdr */ #ifdef HAVE_GETHOSTBYNAME #define MX_RETRIES 3 -static int is_host_alias(name, queryctl) +static int is_host_alias(name, ctl) /* determine whether name is a DNS alias of the hostname */ const char *name; -struct hostrec *queryctl; +struct query *ctl; { struct hostent *he; int i, n; @@ -348,9 +348,9 @@ struct hostrec *queryctl; * 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 (strcmp(name, queryctl->servername) == 0) + if (strcmp(name, ctl->servername) == 0) return(TRUE); - else if (strcmp(name, queryctl->canonical_name) == 0) + else if (strcmp(name, ctl->canonical_name) == 0) return(TRUE); /* @@ -359,7 +359,7 @@ struct hostrec *queryctl; * to respond quickly and reliably. Ergo if we get failure, * the name isn't a mailserver alias. */ - else if ((he = gethostbyname(name)) && strcmp(queryctl->canonical_name, he->h_name) == 0) + else if ((he = gethostbyname(name)) && strcmp(ctl->canonical_name, he->h_name) == 0) return(TRUE); /* @@ -390,10 +390,10 @@ struct hostrec *queryctl; return(FALSE); } -void find_server_names(hdr, queryctl, xmit_names) +void find_server_names(hdr, ctl, xmit_names) /* parse names out of a RFC822 header into an ID list */ const char *hdr; /* RFC822 header in question */ -struct hostrec *queryctl; /* list of permissible aliases */ +struct query *ctl; /* list of permissible aliases */ struct idlist **xmit_names; /* list of recipient names parsed out */ { if (hdr == (char *)NULL) @@ -407,15 +407,15 @@ struct idlist **xmit_names; /* list of recipient names parsed out */ char *atsign = strchr(cp, '@'); if (atsign) - if (queryctl->norewrite) + if (ctl->norewrite) continue; else { - if (!is_host_alias(atsign+1, queryctl)) + if (!is_host_alias(atsign+1, ctl)) continue; atsign[0] = '\0'; } - lname = idpair_find(&queryctl->localnames, cp); + lname = idpair_find(&ctl->localnames, cp); if (lname != (char *)NULL) { if (outlevel == O_VERBOSE) @@ -430,13 +430,13 @@ struct idlist **xmit_names; /* list of recipient names parsed out */ } #endif /* HAVE_GETHOSTBYNAME */ -static int gen_readmsg (socket, mboxfd, len, delimited, queryctl) +static int gen_readmsg (socket, mboxfd, len, delimited, ctl) /* read message content and ship to SMTP or MDA */ int socket; /* to which the server is connected */ int mboxfd; /* descriptor to which retrieved message will be written */ long len; /* length of message */ int delimited; /* does the protocol use a message delimiter? */ -struct hostrec *queryctl; /* query control record */ +struct query *ctl; /* query control record */ { char buf [MSGBUFSIZE+1]; char fromBuf[MSGBUFSIZE+1]; @@ -480,8 +480,8 @@ struct hostrec *queryctl; /* query control record */ if (inheaders) { - if (!queryctl->norewrite) - reply_hack(bufp, queryctl->servername); + if (!ctl->norewrite) + reply_hack(bufp, ctl->servername); if (!lines) { @@ -539,13 +539,13 @@ struct hostrec *queryctl; /* query control record */ xmit_names = (struct idlist *)NULL; #ifdef HAVE_GETHOSTBYNAME /* is this a multidrop box? */ - if (queryctl->localnames != (struct idlist *)NULL - && queryctl->localnames->next != (struct idlist *)NULL) + if (ctl->localnames != (struct idlist *)NULL + && ctl->localnames->next != (struct idlist *)NULL) { /* compute the local address list */ - find_server_names(tohdr, queryctl, &xmit_names); - find_server_names(cchdr, queryctl, &xmit_names); - find_server_names(bcchdr, queryctl, &xmit_names); + find_server_names(tohdr, ctl, &xmit_names); + find_server_names(cchdr, ctl, &xmit_names); + find_server_names(bcchdr, ctl, &xmit_names); /* if nothing supplied localnames, default appropriately */ if (!xmit_names) @@ -554,14 +554,14 @@ struct hostrec *queryctl; /* query control record */ else /* it's a single-drop box, use first localname */ #endif /* HAVE_GETHOSTBYNAME */ { - if (queryctl->localnames) - save_uid(&xmit_names, -1, queryctl->localnames->id); + if (ctl->localnames) + save_uid(&xmit_names, -1, ctl->localnames->id); else save_uid(&xmit_names, -1, dfltuser); } /* time to address the message */ - if (queryctl->mda[0]) /* we have a declared MDA */ + if (ctl->mda[0]) /* we have a declared MDA */ { int i, nlocals = 0; char **sargv, **sp; @@ -572,9 +572,9 @@ struct hostrec *queryctl; /* query control record */ */ for (idp = xmit_names; idp; idp = idp->next) nlocals++; - sp = sargv = (char **)alloca(queryctl->mda_argcount+nlocals+2); - for (i = 0; i <= queryctl->mda_argcount; i++) - *sp++ = queryctl->mda_argv[i]; + sp = sargv = (char **)alloca(ctl->mda_argcount+nlocals+2); + for (i = 0; i <= ctl->mda_argcount; i++) + *sp++ = ctl->mda_argv[i]; for (idp = xmit_names; idp; idp = idp->next) *sp++ = idp->id; *sp = (char *)NULL; @@ -586,7 +586,7 @@ struct hostrec *queryctl; /* query control record */ * MDA creates properly. (The seteuid call is available * under all BSDs and Linux) */ - seteuid(queryctl->uid); + seteuid(ctl->uid); #endif /* HAVE_SETEUID */ mboxfd = openmailpipe(sargv); @@ -620,7 +620,7 @@ struct hostrec *queryctl; /* query control record */ *cp = '\n'; /* replace all LFs with CR-LF before sending to the SMTP server */ - if (!queryctl->mda[0]) + if (!ctl->mda[0]) { char *newheaders = malloc(1 + oldlen * 2); @@ -644,11 +644,11 @@ struct hostrec *queryctl; /* query control record */ } /* SMTP byte-stuffing */ - if (*bufp == '.' && queryctl->mda[0] == 0) + if (*bufp == '.' && ctl->mda[0] == 0) write(mboxfd, ".", 1); /* write this line to the file after replacing all LFs with CR-LF */ - if (!queryctl->mda[0]) + if (!ctl->mda[0]) { char *newbufp = malloc(1 + strlen(bufp) * 2); @@ -658,7 +658,7 @@ struct hostrec *queryctl; /* query control record */ bufp = newbufp; } n = write(mboxfd,bufp,strlen(bufp)); - if (!queryctl->mda[0]) + if (!ctl->mda[0]) free(bufp); if (n < 0) { @@ -672,7 +672,7 @@ struct hostrec *queryctl; /* query control record */ lines++; } - if (queryctl->mda[0]) + if (ctl->mda[0]) { /* close the delivery pipe, we'll reopen before next message */ if (closemailpipe(mboxfd)) @@ -723,16 +723,16 @@ char *canonical; /* server name */ } #endif /* KERBEROS_V4 */ -int do_protocol(queryctl, proto) +int do_protocol(ctl, proto) /* retrieve messages from server using given protocol method table */ -struct hostrec *queryctl; /* parsed options with merged-in defaults */ +struct query *ctl; /* parsed options with merged-in defaults */ struct method *proto; /* protocol method table */ { int ok, mboxfd = -1; void (*sigsave)() = signal(SIGALRM, alarm_handler); #ifndef KERBEROS_V4 - if (queryctl->authenticate == A_KERBEROS) + if (ctl->authenticate == A_KERBEROS) { fputs("fetchmail: Kerberos support not linked.\n", stderr); return(PS_ERROR); @@ -743,7 +743,7 @@ struct method *proto; /* protocol method table */ if (!proto->is_old) { /* check for unsupported options */ - if (queryctl->flush) { + if (ctl->flush) { fprintf(stderr, "Option --flush is not supported with %s\n", proto->name); @@ -751,7 +751,7 @@ struct method *proto; /* protocol method table */ signal(SIGALRM, sigsave); return(PS_SYNTAX); } - else if (queryctl->fetchall) { + else if (ctl->fetchall) { fprintf(stderr, "Option --all is not supported with %s\n", proto->name); @@ -760,7 +760,7 @@ struct method *proto; /* protocol method table */ return(PS_SYNTAX); } } - if (!proto->getsizes && queryctl->limit) + if (!proto->getsizes && ctl->limit) { fprintf(stderr, "Option --limit is not supported with %s\n", @@ -778,17 +778,17 @@ struct method *proto; /* protocol method table */ if (setjmp(restart) == 1) fprintf(stderr, "fetchmail: timeout after %d seconds waiting for %s.\n", - queryctl->timeout, queryctl->servername); + ctl->timeout, ctl->servername); else { char buf [POPBUFSIZE+1], host[HOSTLEN+1]; int *msgsizes, socket, len, num, count, new, deletions = 0; - alarm(queryctl->timeout); + alarm(ctl->timeout); /* open a socket to the mail server */ - if ((socket = Socket(queryctl->servername, - queryctl->port ? queryctl->port : protocol->port))<0) + if ((socket = Socket(ctl->servername, + ctl->port ? ctl->port : protocol->port))<0) { perror("fetchmail, connecting to host"); ok = PS_SOCKET; @@ -796,9 +796,9 @@ struct method *proto; /* protocol method table */ } #ifdef KERBEROS_V4 - if (queryctl->authenticate == A_KERBEROS) + if (ctl->authenticate == A_KERBEROS) { - ok = (kerberos_auth (socket, queryctl->canonical_name)); + ok = (kerberos_auth (socket, ctl->canonical_name)); if (ok != 0) goto cleanUp; } @@ -810,8 +810,8 @@ struct method *proto; /* protocol method table */ goto cleanUp; /* try to get authorized to fetch mail */ - shroud = queryctl->password; - ok = (protocol->getauth)(socket, queryctl, buf); + shroud = ctl->password; + ok = (protocol->getauth)(socket, ctl, buf); shroud = (char *)NULL; if (ok == PS_ERROR) ok = PS_AUTHFAIL; @@ -819,15 +819,15 @@ struct method *proto; /* protocol method table */ goto cleanUp; /* compute number of messages and number of new messages waiting */ - if ((protocol->getrange)(socket, queryctl, &count, &new) != 0) + if ((protocol->getrange)(socket, ctl, &count, &new) != 0) goto cleanUp; /* show user how many messages we downloaded */ if (outlevel > O_SILENT && outlevel < O_VERBOSE) if (count == 0) fprintf(stderr, "No mail from %s@%s\n", - queryctl->remotename, - queryctl->servername); + ctl->remotename, + ctl->servername); else { fprintf(stderr, "%d message%s", count, count > 1 ? "s" : ""); @@ -835,29 +835,29 @@ struct method *proto; /* protocol method table */ fprintf(stderr, " (%d seen)", count-new); fprintf(stderr, " from %s@%s.\n", - queryctl->remotename, - queryctl->servername); + ctl->remotename, + ctl->servername); } /* we may need to get sizes in order to check message limits */ msgsizes = (int *)NULL; - if (!queryctl->fetchall && proto->getsizes && queryctl->limit) + if (!ctl->fetchall && proto->getsizes && ctl->limit) if ((msgsizes = (proto->getsizes)(socket, count)) == (int *)NULL) return(PS_ERROR); if (check_only) { - if (new == -1 || queryctl->fetchall) + if (new == -1 || ctl->fetchall) new = count; ok = ((new > 0) ? PS_SUCCESS : PS_NOMAIL); goto closeUp; } else if (count > 0) { - if (queryctl->mda[0] == '\0') - if ((mboxfd = Socket(queryctl->smtphost, SMTP_PORT)) < 0 + if (ctl->mda[0] == '\0') + if ((mboxfd = Socket(ctl->smtphost, SMTP_PORT)) < 0 || SMTP_ok(mboxfd, NULL) != SM_OK - || SMTP_helo(mboxfd, queryctl->servername) != SM_OK) + || SMTP_helo(mboxfd, ctl->servername) != SM_OK) { ok = PS_SMTP; close(mboxfd); @@ -868,9 +868,9 @@ struct method *proto; /* protocol method table */ /* read, forward, and delete messages */ for (num = 1; num <= count; num++) { - int toolarge = msgsizes && msgsizes[num-1]>queryctl->limit; - int fetch_it = queryctl->fetchall || - (!(protocol->is_old && (protocol->is_old)(socket,queryctl,num)) && !toolarge); + int toolarge = msgsizes && msgsizes[num-1]>ctl->limit; + int fetch_it = ctl->fetchall || + (!(protocol->is_old && (protocol->is_old)(socket,ctl,num)) && !toolarge); /* we may want to reject this message if it's old */ if (!fetch_it) @@ -910,11 +910,11 @@ struct method *proto; /* protocol method table */ ok = gen_readmsg(socket, mboxfd, len, protocol->delimited, - queryctl); + ctl); /* tell the server we got it OK and resynchronize */ if (protocol->trail) - (protocol->trail)(socket, queryctl, num); + (protocol->trail)(socket, ctl, num); if (ok != 0) goto cleanUp; } @@ -930,19 +930,19 @@ struct method *proto; /* protocol method table */ /* maybe we delete this message now? */ if (protocol->delete - && (fetch_it ? !queryctl->keep : queryctl->flush)) + && (fetch_it ? !ctl->keep : ctl->flush)) { deletions++; if (outlevel > O_SILENT) fprintf(stderr, " flushed\n", num); - ok = (protocol->delete)(socket, queryctl, num); + ok = (protocol->delete)(socket, ctl, num); if (ok != 0) goto cleanUp; } else if (outlevel > O_SILENT) { /* nuke it from the unseen-messages list */ - delete_uid(&queryctl->newsaved, num); + delete_uid(&ctl->newsaved, num); fprintf(stderr, " not flushed\n", num); } } @@ -983,7 +983,7 @@ struct method *proto; /* protocol method table */ closeUp: if (mboxfd != -1) { - if (!queryctl->mda[0]) + if (!ctl->mda[0]) SMTP_quit(mboxfd); close(mboxfd); } diff --git a/fetchmail.c b/fetchmail.c index e2a82e5e..9a0e38e6 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -37,8 +37,8 @@ #ifdef HAVE_PROTOTYPES /* prototypes for internal functions */ -static int dump_options (struct hostrec *queryctl); -static int query_host(struct hostrec *queryctl); +static int dump_options (struct query *); +static int query_host(struct query *); static char *visbuf(const char *); #endif @@ -61,7 +61,7 @@ char *dfltuser; /* invoking user */ static void termhook(); static char *lockfile; static int popstatus; -static struct hostrec *hostp; +static struct query *ctl; RETSIGTYPE donothing(sig) int sig; {signal(sig, donothing);} @@ -70,14 +70,14 @@ int argc; char **argv; { int mboxfd, st, bkgd, lossage; - struct hostrec def_opts; + struct query def_opts; int parsestatus, implicitmode; char *servername, *user, *home, *tmpdir, tmpbuf[BUFSIZ]; struct passwd *pw; FILE *lockfp; pid_t pid; - memset(&def_opts, '\0', sizeof(struct hostrec)); + memset(&def_opts, '\0', sizeof(struct query)); if ((user = getenv("USER")) == (char *)NULL) user = getenv("LOGNAME"); @@ -136,8 +136,8 @@ char **argv; if (implicitmode = (optind >= argc)) { - for (hostp = hostlist; hostp; hostp = hostp->next) - hostp->active = TRUE; + for (ctl = querylist; ctl; ctl = ctl->next) + ctl->active = TRUE; } else for (; optind < argc; optind++) @@ -147,49 +147,49 @@ char **argv; * simply declare it active. Otherwise synthesize a host * record from command line and defaults */ - for (hostp = hostlist; hostp; hostp = hostp->next) - if (strcmp(hostp->servername, argv[optind]) == 0) + for (ctl = querylist; ctl; ctl = ctl->next) + if (strcmp(ctl->servername, argv[optind]) == 0) goto foundit; - hostp = hostalloc(&cmd_opts); - strcpy(hostp->servername, argv[optind]); + ctl = hostalloc(&cmd_opts); + strcpy(ctl->servername, argv[optind]); foundit: - hostp->active = TRUE; + ctl->active = TRUE; } /* if there's a defaults record, merge it and lose it */ - if (hostlist && strcmp(hostlist->servername, "defaults") == 0) + if (querylist && strcmp(querylist->servername, "defaults") == 0) { - for (hostp = hostlist; hostp; hostp = hostp->next) - optmerge(hostp, hostlist); - hostlist = hostlist->next; + for (ctl = querylist; ctl; ctl = ctl->next) + optmerge(ctl, querylist); + querylist = querylist->next; } /* don't allow a defaults record after the first */ - for (hostp = hostlist; hostp; hostp = hostp->next) - if (strcmp(hostp->servername, "defaults") == 0) + for (ctl = querylist; ctl; ctl = ctl->next) + if (strcmp(ctl->servername, "defaults") == 0) exit(PS_SYNTAX); /* figure out who the default recipient should be */ if (getuid() == 0) - dfltuser = hostp->remotename; + dfltuser = ctl->remotename; else dfltuser = user; /* merge in wired defaults, do sanity checks and prepare internal fields */ - for (hostp = hostlist; hostp; hostp = hostp->next) - if (hostp->active && !(implicitmode && hostp->skip)) + for (ctl = querylist; ctl; ctl = ctl->next) + if (ctl->active && !(implicitmode && ctl->skip)) { #ifdef HAVE_GETHOSTBYNAME struct hostent *namerec; #endif /* HAVE_GETHOSTBYNAME */ /* merge in defaults */ - optmerge(hostp, &def_opts); + optmerge(ctl, &def_opts); /* keep lusers from shooting themselves in the foot :-) */ - if (poll_interval && hostp->limit) + if (poll_interval && ctl->limit) { fprintf(stderr,"fetchmail: you'd never see large messages!\n"); exit(PS_SYNTAX); @@ -203,23 +203,23 @@ char **argv; exit(PS_SYNTAX); /* has to be from bad rc file */ } else - hostp->uid = pw->pw_uid; + ctl->uid = pw->pw_uid; #ifdef HAVE_GETHOSTBYNAME /* compute the canonical name of the host */ - namerec = gethostbyname(hostp->servername); + namerec = gethostbyname(ctl->servername); if (namerec == (struct hostent *)NULL) { fprintf(stderr, "fetchmail: can't get canonical name of host %s\n", - hostp->servername); + ctl->servername); exit(PS_SYNTAX); } else - hostp->canonical_name = xstrdup((char *)namerec->h_name); + ctl->canonical_name = xstrdup((char *)namerec->h_name); #else /* can't handle multidrop mailboxes unless we can do DNS lookups */ - if (hostp->localnames && hostp->localnames->next) + if (ctl->localnames && ctl->localnames->next) { fputs("fetchmail: can't handle multidrop mailboxes without DNS\n", stderr); @@ -228,34 +228,34 @@ char **argv; #endif /* HAVE_GETHOSTBYNAME */ /* sanity checks */ - if (hostp->port < 0) + if (ctl->port < 0) { (void) fprintf(stderr, "%s configuration invalid, port number cannot be negative", - hostp->servername); + ctl->servername); exit(PS_SYNTAX); } /* expand MDA commands */ - if (!check_only && hostp->mda[0]) + if (!check_only && ctl->mda[0]) { char *argp; /* punch nulls into the delimiting whitespace in the args */ - for (argp = hostp->mda, hostp->mda_argcount = 1; *argp != '\0'; hostp->mda_argcount++) + for (argp = ctl->mda, ctl->mda_argcount = 1; *argp != '\0'; ctl->mda_argcount++) { - hostp->mda_argv[hostp->mda_argcount] = argp; + ctl->mda_argv[ctl->mda_argcount] = argp; while (!(*argp == '\0' || isspace(*argp))) argp++; if (*argp != '\0') *(argp++) = '\0'; } - hostp->mda_argv[hostp->mda_argcount] = (char *)NULL; + ctl->mda_argv[ctl->mda_argcount] = (char *)NULL; - hostp->mda_argv[0] = hostp->mda_argv[1]; - if ((argp = strrchr(hostp->mda_argv[1], '/')) != (char *)NULL) - hostp->mda_argv[1] = argp + 1 ; + ctl->mda_argv[0] = ctl->mda_argv[1]; + if ((argp = strrchr(ctl->mda_argv[1], '/')) != (char *)NULL) + ctl->mda_argv[1] = argp + 1 ; } } @@ -270,7 +270,7 @@ char **argv; if ((st = prc_filecheck(idfile)) != 0) exit(st); else - initialize_saved_lists(hostlist, idfile); + initialize_saved_lists(querylist, idfile); /* perhaps we just want to check options? */ if (versioninfo) { @@ -281,17 +281,17 @@ char **argv; printf(" and %s\n", rcfile); if (outlevel == O_VERBOSE) printf("Lockfile at %s\n", tmpbuf); - for (hostp = hostlist; hostp; hostp = hostp->next) { - if (hostp->active && !(implicitmode && hostp->skip)) - dump_params(hostp); + for (ctl = querylist; ctl; ctl = ctl->next) { + if (ctl->active && !(implicitmode && ctl->skip)) + dump_params(ctl); } - if (hostlist == NULL) + if (querylist == NULL) (void) fprintf(stderr, "No mailservers set up -- perhaps %s is missing?\n", rcfile); exit(0); } - else if (hostlist == NULL) { + else if (querylist == NULL) { (void) fputs("fetchmail: no mailservers have been specified.\n", stderr); exit(PS_SYNTAX); } @@ -382,19 +382,19 @@ char **argv; } /* pick up interactively any passwords we need but don't have */ - for (hostp = hostlist; hostp; hostp = hostp->next) - if (hostp->active && !(implicitmode && hostp->skip) && !hostp->password[0]) + for (ctl = querylist; ctl; ctl = ctl->next) + if (ctl->active && !(implicitmode && ctl->skip) && !ctl->password[0]) { - if (hostp->authenticate == A_KERBEROS) + if (ctl->authenticate == A_KERBEROS) /* Server won't care what the password is, but there must be some non-null string here. */ - (void) strncpy(hostp->password, - hostp->remotename, PASSWORDLEN-1); + (void) strncpy(ctl->password, + ctl->remotename, PASSWORDLEN-1); else { (void) sprintf(tmpbuf, "Enter password for %s@%s: ", - hostp->remotename, hostp->servername); - (void) strncpy(hostp->password, + ctl->remotename, ctl->servername); + (void) strncpy(ctl->password, (char *)getpassword(tmpbuf),PASSWORDLEN-1); } } @@ -440,11 +440,11 @@ char **argv; sethostent(TRUE); /* use TCP/IP for mailserver queries */ #endif /* HAVE_GETHOSTBYNAME */ - for (hostp = hostlist; hostp; hostp = hostp->next) + for (ctl = querylist; ctl; ctl = ctl->next) { - if (hostp->active && !(implicitmode && hostp->skip)) + if (ctl->active && !(implicitmode && ctl->skip)) { - popstatus = query_host(hostp); + popstatus = query_host(ctl); /* * Under Linux, if fetchmail is run in daemon mode @@ -471,7 +471,7 @@ char **argv; } if (!check_only) - update_uid_lists(hostp); + update_uid_lists(ctl); } } @@ -498,7 +498,7 @@ void termhook(int sig) fprintf(stderr, "terminated with signal %d\n", sig); if (!check_only) - write_saved_lists(hostlist, idfile); + write_saved_lists(querylist, idfile); unlink(lockfile); exit(popstatus); @@ -524,9 +524,9 @@ int proto; */ static const int autoprobe[] = {P_IMAP, P_POP3, P_POP2}; -static int query_host(queryctl) +static int query_host(ctl) /* perform fetch transaction with single host */ -struct hostrec *queryctl; +struct query *ctl; { int i, st; @@ -536,28 +536,28 @@ struct hostrec *queryctl; time(&now); fprintf(stderr, "Querying %s (protocol %s) at %s", - queryctl->servername, showproto(queryctl->protocol), ctime(&now)); + ctl->servername, showproto(ctl->protocol), ctime(&now)); } - switch (queryctl->protocol) { + switch (ctl->protocol) { case P_AUTO: for (i = 0; i < sizeof(autoprobe)/sizeof(autoprobe[0]); i++) { - queryctl->protocol = autoprobe[i]; - if ((st = query_host(queryctl)) == PS_SUCCESS || st == PS_NOMAIL || st == PS_AUTHFAIL) + ctl->protocol = autoprobe[i]; + if ((st = query_host(ctl)) == PS_SUCCESS || st == PS_NOMAIL || st == PS_AUTHFAIL) break; } - queryctl->protocol = P_AUTO; + ctl->protocol = P_AUTO; return(st); break; case P_POP2: - return(doPOP2(queryctl)); + return(doPOP2(ctl)); break; case P_POP3: case P_APOP: - return(doPOP3(queryctl)); + return(doPOP3(ctl)); break; case P_IMAP: - return(doIMAP(queryctl)); + return(doIMAP(ctl)); break; default: fprintf(stderr,"fetchmail: unsupported protocol selected.\n"); @@ -565,110 +565,110 @@ struct hostrec *queryctl; } } -int dump_params (queryctl) +int dump_params (ctl) /* display query parameters in English */ -struct hostrec *queryctl; /* query parameter block */ +struct query *ctl; /* query parameter block */ { printf("Options for retrieving from %s@%s:\n", - hostp->remotename, visbuf(hostp->servername)); + ctl->remotename, visbuf(ctl->servername)); #ifdef HAVE_GETHOSTBYNAME - printf(" Canonical DNS name of server is %s.\n", hostp->canonical_name); + printf(" Canonical DNS name of server is %s.\n", ctl->canonical_name); #endif /* HAVE_GETHOSTBYNAME */ - if (queryctl->skip || outlevel == O_VERBOSE) + if (ctl->skip || outlevel == O_VERBOSE) printf(" This host will%s be queried when no host is specified.\n", - queryctl->skip ? " not" : ""); - if (queryctl->password[0] == '\0') + ctl->skip ? " not" : ""); + if (ctl->password[0] == '\0') printf(" Password will be prompted for.\n"); else if (outlevel == O_VERBOSE) - if (queryctl->protocol == P_APOP) - printf(" APOP secret = '%s'.\n", visbuf(queryctl->password)); + if (ctl->protocol == P_APOP) + printf(" APOP secret = '%s'.\n", visbuf(ctl->password)); else - printf(" Password = '%s'.\n", visbuf(queryctl->password)); - if (queryctl->protocol == P_POP3 - && queryctl->port == KPOP_PORT - && queryctl->authenticate == A_KERBEROS) + printf(" Password = '%s'.\n", visbuf(ctl->password)); + if (ctl->protocol == P_POP3 + && ctl->port == KPOP_PORT + && ctl->authenticate == A_KERBEROS) printf(" Protocol is KPOP"); else { - printf(" Protocol is %s", showproto(queryctl->protocol)); + printf(" Protocol is %s", showproto(ctl->protocol)); } - if (queryctl->port) - printf(" (using port %d)", queryctl->port); + if (ctl->port) + printf(" (using port %d)", ctl->port); else if (outlevel == O_VERBOSE) printf(" (using default port)"); putchar('.'); putchar('\n'); - if (queryctl->authenticate == A_KERBEROS) + if (ctl->authenticate == A_KERBEROS) printf(" Kerberos authentication enabled.\n"); - printf(" Server nonresponse timeout is %d seconds", queryctl->timeout); - if (queryctl->timeout == CLIENT_TIMEOUT) + printf(" Server nonresponse timeout is %d seconds", ctl->timeout); + if (ctl->timeout == CLIENT_TIMEOUT) printf(" (default).\n"); else printf("\n."); printf(" %s messages will be retrieved (--all %s).\n", - queryctl->fetchall ? "All" : "Only new", - queryctl->fetchall ? "on" : "off"); + ctl->fetchall ? "All" : "Only new", + ctl->fetchall ? "on" : "off"); printf(" Fetched messages will%s be kept on the server (--keep %s).\n", - queryctl->keep ? "" : " not", - queryctl->keep ? "on" : "off"); + ctl->keep ? "" : " not", + ctl->keep ? "on" : "off"); printf(" Old messages will%s be flushed before message retrieval (--flush %s).\n", - queryctl->flush ? "" : " not", - queryctl->flush ? "on" : "off"); + ctl->flush ? "" : " not", + ctl->flush ? "on" : "off"); printf(" Rewrite of server-local addresses is %sabled (--norewrite %s).\n", - queryctl->norewrite ? "dis" : "en", - queryctl->norewrite ? "on" : "off"); - if (queryctl->limit) - printf(" Message size limit is %d bytes\n", queryctl->limit); + ctl->norewrite ? "dis" : "en", + ctl->norewrite ? "on" : "off"); + if (ctl->limit) + printf(" Message size limit is %d bytes\n", ctl->limit); else if (outlevel == O_VERBOSE) printf(" No message size limit\n"); - if (queryctl->mda[0]) + if (ctl->mda[0]) { char **cp; printf(" Messages will be delivered with %s, args:", - visbuf(queryctl->mda_argv[0])); - for (cp = queryctl->mda_argv+1; *cp; cp++) + visbuf(ctl->mda_argv[0])); + for (cp = ctl->mda_argv+1; *cp; cp++) printf(" %s", visbuf(*cp)); putchar('\n'); } else printf(" Messages will be SMTP-forwarded to '%s'.\n", - visbuf(queryctl->smtphost)); - if (!queryctl->localnames) + visbuf(ctl->smtphost)); + if (!ctl->localnames) printf(" No localnames declared for this host.\n"); else { struct idlist *idp; int count = 0; - for (idp = hostp->localnames; idp; idp = idp->next) + for (idp = ctl->localnames; idp; idp = idp->next) ++count; printf(" %d local names recognized.\n", count); if (outlevel == O_VERBOSE) - for (idp = hostp->localnames; idp; idp = idp->next) + for (idp = ctl->localnames; idp; idp = idp->next) if (idp->val.id2) fprintf(stderr, "\t%s -> %s\n", idp->id, idp->val.id2); else fprintf(stderr, "\t%s\n", idp->id); } - if (queryctl->protocol > P_POP2) - if (!queryctl->oldsaved) + if (ctl->protocol > P_POP2) + if (!ctl->oldsaved) printf(" No UIDs saved from this host.\n"); else { struct idlist *idp; int count = 0; - for (idp = hostp->oldsaved; idp; idp = idp->next) + for (idp = ctl->oldsaved; idp; idp = idp->next) ++count; printf(" %d UIDs saved.\n", count); if (outlevel == O_VERBOSE) - for (idp = hostp->oldsaved; idp; idp = idp->next) - fprintf(stderr, "\t%s %s\n", hostp->servername, idp->id); + for (idp = ctl->oldsaved; idp; idp = idp->next) + fprintf(stderr, "\t%s %s\n", ctl->servername, idp->id); } } diff --git a/fetchmail.h b/fetchmail.h index eac06c99..a34b0e43 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -58,39 +58,41 @@ struct idlist struct idlist *next; }; -struct hostrec +struct query { /* per-host data */ char servername [HOSTLEN+1]; - char remotename [USERNAMELEN+1]; - char password [PASSWORDLEN+1]; - char mailbox [FOLDERLEN]; - char smtphost[HOSTLEN+1]; - char mda [MDALEN+1]; struct idlist *localnames; int protocol; int port; int authenticate; int timeout; - int limit; + int skip; - /* MDA arguments */ + /* per-user data */ + char remotename [USERNAMELEN+1]; + char password [PASSWORDLEN+1]; + char mailbox [FOLDERLEN]; + char smtphost[HOSTLEN+1]; + char mda [MDALEN+1]; + + /* per-user MDA arguments */ int mda_argcount; char *mda_argv[MDA_MAXARGS]; - /* control flags */ + /* per-user control flags */ int keep; int fetchall; int flush; int norewrite; - int skip; + int limit; /* unseen, previous state of mailbox (initially from .fetchids) */ struct idlist *oldsaved, *newsaved; /* internal use */ int active; - struct hostrec *next; /* next host in chain */ + struct query *next; /* next host in chain */ unsigned int uid; /* UID of user to deliver to */ char digest [DIGESTLEN]; #ifdef HAVE_GETHOSTBYNAME @@ -120,7 +122,7 @@ struct method extern char tag[TAGLEN]; /* list of hosts assembled from run control file and command line */ -extern struct hostrec cmd_opts, *hostlist; +extern struct query cmd_opts, *querylist; /* controls the detail level of status/progress messages written to stderr */ extern int outlevel; /* see the O_.* constants above */ @@ -143,8 +145,8 @@ extern char *dfltuser; /* invoking user */ /* prototypes for globally callable functions */ #if defined(HAVE_STDARG_H) -void gen_send (int socket, char *fmt, ... ); -int gen_transact (int socket, char *fmt, ... ); +void gen_send (int socket, char *, ... ); +int gen_transact (int socket, char *, ... ); #else void gen_send (); int gen_transact (); @@ -153,11 +155,11 @@ int gen_transact (); void *xmalloc(int); char *xstrdup(char *); -int doPOP2 (struct hostrec *); -int doPOP3 (struct hostrec *); -int doIMAP (struct hostrec *); +int doPOP2 (struct query *); +int doPOP3 (struct query *); +int doIMAP (struct query *); -void initialize_saved_lists(struct hostrec *, char *); +void initialize_saved_lists(struct query *, char *); void save_uid(struct idlist **, int, char *); void free_uid_list(struct idlist **); void save_id_pair(struct idlist **, char *, char *); @@ -167,12 +169,12 @@ int uid_in_list(struct idlist **, char *); char *uid_find(struct idlist **, int); char *idpair_find(struct idlist **, char *); void append_uid_list(struct idlist **, struct idlist **); -void update_uid_lists(struct hostrec *); -void write_saved_lists(struct hostrec *, char *); +void update_uid_lists(struct query *); +void write_saved_lists(struct query *, char *); -struct hostrec *hostalloc(struct hostrec *); -int parsecmdline (int, char **, struct hostrec *); -void optmerge(struct hostrec *, struct hostrec *); +struct query *hostalloc(struct query *); +int parsecmdline (int, char **, struct query *); +void optmerge(struct query *, struct query *); char *MD5Digest (char *); int openmailpipe (char **); int daemonize(const char *, void (*)(int)); @@ -181,7 +183,7 @@ void escapes(const char *, char *); #else -struct hostrec *hostinit(); +struct query *hostinit(); char *MD5Digest (); void optmerge(); @@ -71,22 +71,22 @@ int socket; } } -int imap_getauth(socket, queryctl, buf) +int imap_getauth(socket, ctl, buf) /* apply for connection authorization */ int socket; -struct hostrec *queryctl; +struct query *ctl; char *buf; { /* try to get authorized */ return(gen_transact(socket, "LOGIN %s \"%s\"", - queryctl->remotename, queryctl->password)); + ctl->remotename, ctl->password)); } -static imap_getrange(socket, queryctl, countp, newp) +static imap_getrange(socket, ctl, countp, newp) /* get range of messages to be fetched */ int socket; -struct hostrec *queryctl; +struct query *ctl; int *countp, *newp; { int ok; @@ -95,7 +95,7 @@ int *countp, *newp; recent = unseen = 0; ok = gen_transact(socket, "SELECT %s", - queryctl->mailbox[0] ? queryctl->mailbox : "INBOX"); + ctl->mailbox[0] ? ctl->mailbox : "INBOX"); if (ok != 0) return(ok); @@ -143,9 +143,9 @@ int count; } } -static imap_is_old(socket, queryctl, num) +static imap_is_old(socket, ctl, num) int socket; -struct hostrec *queryctl; +struct query *ctl; int num; { char buf [POPBUFSIZE+1]; @@ -181,10 +181,10 @@ int *lenp; return(0); } -static imap_trail(socket, queryctl, number) +static imap_trail(socket, ctl, number) /* discard tail of FETCH response */ int socket; -struct hostrec *queryctl; +struct query *ctl; int number; { char buf [POPBUFSIZE+1]; @@ -195,10 +195,10 @@ int number; return(0); } -static imap_delete(socket, queryctl, number) +static imap_delete(socket, ctl, number) /* set delete flag for given message */ int socket; -struct hostrec *queryctl; +struct query *ctl; int number; { return(gen_transact(socket, "STORE %d +FLAGS (\\Deleted)", number)); @@ -222,11 +222,11 @@ const static struct method imap = "LOGOUT", /* the IMAP exit command */ }; -int doIMAP (queryctl) +int doIMAP(ctl) /* retrieve messages using IMAP Version 2bis or Version 4 */ -struct hostrec *queryctl; +struct query *ctl; { - return(do_protocol(queryctl, &imap)); + return(do_protocol(ctl, &imap)); } /* imap.c ends here */ @@ -75,11 +75,11 @@ static struct option longoptions[] = { {(char *) 0, no_argument, (int *) 0, 0 } }; -int parsecmdline (argc,argv,queryctl) +int parsecmdline (argc,argv,ctl) /* parse and validate the command line options */ int argc; /* argument count */ char **argv; /* argument strings */ -struct hostrec *queryctl; /* option record to be initialized */ +struct query *ctl; /* option record to be initialized */ { /* * return value: if positive, argv index of last parsed option + 1 @@ -94,7 +94,7 @@ struct hostrec *queryctl; /* option record to be initialized */ int errflag = 0; /* TRUE when a syntax error is detected */ int option_index; - memset(queryctl, '\0', sizeof(struct hostrec)); /* start clean */ + memset(ctl, '\0', sizeof(struct query)); /* start clean */ while (!errflag && (c = getopt_long(argc,argv,shortoptions, @@ -143,18 +143,18 @@ struct hostrec *queryctl; /* option record to be initialized */ case LA_PROTOCOL: /* XXX -- should probably use a table lookup here */ if (strcasecmp(optarg,"pop2") == 0) - queryctl->protocol = P_POP2; + ctl->protocol = P_POP2; else if (strcasecmp(optarg,"pop3") == 0) - queryctl->protocol = P_POP3; + ctl->protocol = P_POP3; else if (strcasecmp(optarg,"imap") == 0) - queryctl->protocol = P_IMAP; + ctl->protocol = P_IMAP; else if (strcasecmp(optarg,"apop") == 0) - queryctl->protocol = P_APOP; + ctl->protocol = P_APOP; else if (strcasecmp(optarg,"kpop") == 0) { - queryctl->protocol = P_POP3; - queryctl->port = KPOP_PORT; - queryctl->authenticate = A_KERBEROS; + ctl->protocol = P_POP3; + ctl->port = KPOP_PORT; + ctl->authenticate = A_KERBEROS; } else { fprintf(stderr,"Invalid protocol `%s' specified.\n", optarg); @@ -163,63 +163,63 @@ struct hostrec *queryctl; /* option record to be initialized */ break; case 'P': case LA_PORT: - queryctl->port = atoi(optarg); + ctl->port = atoi(optarg); break; case 'A': case LA_AUTHENTICATE: if (strcmp(optarg, "password") == 0) - queryctl->authenticate = A_PASSWORD; + ctl->authenticate = A_PASSWORD; else if (strcmp(optarg, "kerberos") == 0) - queryctl->authenticate = A_KERBEROS; + ctl->authenticate = A_KERBEROS; else { fprintf(stderr,"Invalid authentication `%s' specified.\n", optarg); errflag++; } break; case 't': - queryctl->timeout = atoi(optarg); + ctl->timeout = atoi(optarg); break; case 'u': case LA_USERNAME: - strncpy(queryctl->remotename,optarg,sizeof(queryctl->remotename)-1); + strncpy(ctl->remotename,optarg,sizeof(ctl->remotename)-1); break; case 'a': case LA_ALL: - queryctl->fetchall = TRUE; + ctl->fetchall = TRUE; break; case 'K': case LA_KILL: - queryctl->keep = FALSE; + ctl->keep = FALSE; break; case 'k': case LA_KEEP: - queryctl->keep = TRUE; + ctl->keep = TRUE; break; case 'F': case LA_FLUSH: - queryctl->flush = TRUE; + ctl->flush = TRUE; break; case 'n': case LA_NOREWRITE: - queryctl->norewrite = TRUE; + ctl->norewrite = TRUE; break; case 'l': case LA_LIMIT: - queryctl->limit = atoi(optarg); + ctl->limit = atoi(optarg); break; case 'r': case LA_REMOTEFILE: - strncpy(queryctl->mailbox,optarg,sizeof(queryctl->mailbox)-1); + strncpy(ctl->mailbox,optarg,sizeof(ctl->mailbox)-1); break; case 'S': case LA_SMTPHOST: - strncpy(queryctl->smtphost,optarg,sizeof(queryctl->smtphost)-1); + strncpy(ctl->smtphost,optarg,sizeof(ctl->smtphost)-1); ocount++; break; case 'm': case LA_MDA: - strncpy(queryctl->mda,optarg,sizeof(queryctl->mda)); + strncpy(ctl->mda,optarg,sizeof(ctl->mda)); ocount++; break; case 'y': @@ -52,21 +52,21 @@ char *argbuf; return(ok); } -int pop2_getauth(socket, queryctl, buf) +int pop2_getauth(socket, ctl, buf) /* apply for connection authorization */ int socket; -struct hostrec *queryctl; +struct query *ctl; char *buf; { return(gen_transact(socket, "HELO %s %s", - queryctl->remotename, queryctl->password)); + ctl->remotename, ctl->password)); } -static pop2_getrange(socket, queryctl, countp, newp) +static pop2_getrange(socket, ctl, countp, newp) /* get range of messages to be fetched */ int socket; -struct hostrec *queryctl; +struct query *ctl; int *countp, *newp; { /* @@ -77,9 +77,9 @@ int *countp, *newp; return(PS_ERROR); /* maybe the user wanted a non-default folder */ - if (queryctl->mailbox[0]) + if (ctl->mailbox[0]) { - int ok = gen_transact(socket, "FOLD %s", queryctl->mailbox); + int ok = gen_transact(socket, "FOLD %s", ctl->mailbox); if (ok != 0) return(ok); @@ -112,13 +112,13 @@ int *lenp; return(ok); } -static pop2_trail(socket, queryctl, number) +static pop2_trail(socket, ctl, number) /* send acknowledgement for message data */ int socket; -struct hostrec *queryctl; +struct query *ctl; int number; { - return(gen_transact(socket, queryctl->keep ? "ACKS" : "ACKD")); + return(gen_transact(socket, ctl->keep ? "ACKS" : "ACKD")); } const static struct method pop2 = @@ -139,11 +139,11 @@ const static struct method pop2 = "QUIT", /* the POP2 exit command */ }; -int doPOP2 (queryctl) +int doPOP2 (ctl) /* retrieve messages using POP2 */ -struct hostrec *queryctl; +struct query *ctl; { - return(do_protocol(queryctl, &pop2)); + return(do_protocol(ctl, &pop2)); } /* pop2.c ends here */ @@ -54,16 +54,16 @@ char *argbuf; return(ok); } -int pop3_getauth(socket, queryctl, greeting) +int pop3_getauth(socket, ctl, greeting) /* apply for connection authorization */ int socket; -struct hostrec *queryctl; +struct query *ctl; char *greeting; { char buf [POPBUFSIZE+1]; /* build MD5 digest from greeting timestamp + password */ - if (queryctl->protocol == P_APOP) + if (ctl->protocol == P_APOP) { char *start,*end; char *msg; @@ -85,27 +85,27 @@ char *greeting; } /* copy timestamp and password into digestion buffer */ - msg = (char *)xmalloc((end-start-1) + strlen(queryctl->password) + 1); + msg = (char *)xmalloc((end-start-1) + strlen(ctl->password) + 1); *(++end) = 0; strcpy(msg,start); - strcat(msg,queryctl->password); + strcat(msg,ctl->password); - strcpy(queryctl->digest, MD5Digest(msg)); + strcpy(ctl->digest, MD5Digest(msg)); free(msg); } - switch (queryctl->protocol) { + switch (ctl->protocol) { case P_POP3: - if ((gen_transact(socket,"USER %s", queryctl->remotename)) != 0) + if ((gen_transact(socket,"USER %s", ctl->remotename)) != 0) PROTOCOL_ERROR - if ((gen_transact(socket, "PASS %s", queryctl->password)) != 0) + if ((gen_transact(socket, "PASS %s", ctl->password)) != 0) PROTOCOL_ERROR break; case P_APOP: if ((gen_transact(socket, "APOP %s %s", - queryctl->remotename, queryctl->digest)) != 0) + ctl->remotename, ctl->digest)) != 0) PROTOCOL_ERROR break; @@ -117,17 +117,17 @@ char *greeting; return(0); } -static pop3_getrange(socket, queryctl, countp, newp) +static pop3_getrange(socket, ctl, countp, newp) /* get range of messages to be fetched */ int socket; -struct hostrec *queryctl; +struct query *ctl; int *countp, *newp; { int ok; char buf [POPBUFSIZE+1]; /* Ensure that the new list is properly empty */ - queryctl->newsaved = (struct idlist *)NULL; + ctl->newsaved = (struct idlist *)NULL; /* get the total message count */ gen_send(socket, "STAT"); @@ -144,7 +144,7 @@ int *countp, *newp; */ last = 0; *newp = -1; - if (*countp > 0 && !queryctl->fetchall) + if (*countp > 0 && !ctl->fetchall) { char id [IDLEN+1]; @@ -174,8 +174,8 @@ int *countp, *newp; break; else if (sscanf(buf, "%d %s", &num, id) == 2) { - save_uid(&queryctl->newsaved, num, id); - if (!uid_in_list(&queryctl->oldsaved, id)) + save_uid(&ctl->newsaved, num, id); + if (!uid_in_list(&ctl->oldsaved, id)) (*newp)++; } } @@ -219,17 +219,17 @@ int count; } } -static int pop3_is_old(socket, queryctl, num) +static int pop3_is_old(socket, ctl, num) /* is the goiven message old? */ int socket; -struct hostrec *queryctl; +struct query *ctl; int num; { - if (!queryctl->oldsaved) + if (!ctl->oldsaved) return (num <= last); else - return (uid_in_list(&queryctl->oldsaved, - uid_find (&queryctl->newsaved, num))); + return (uid_in_list(&ctl->oldsaved, + uid_find (&ctl->newsaved, num))); } static int pop3_fetch(socket, number, lenp) @@ -256,10 +256,10 @@ int *lenp; return(0); } -static pop3_delete(socket, queryctl, number) +static pop3_delete(socket, ctl, number) /* delete a given message */ int socket; -struct hostrec *queryctl; +struct query *ctl; int number; { return(gen_transact(socket, "DELE %d", number)); @@ -283,15 +283,15 @@ const static struct method pop3 = "QUIT", /* the POP3 exit command */ }; -int doPOP3 (queryctl) +int doPOP3 (ctl) /* retrieve messages using POP3 */ -struct hostrec *queryctl; +struct query *ctl; { - if (queryctl->mailbox[0]) { + if (ctl->mailbox[0]) { fprintf(stderr,"Option --remote is not supported with POP3\n"); return(PS_SYNTAX); } - return(do_protocol(queryctl, &pop3)); + return(do_protocol(ctl, &pop3)); } /* pop3.c ends here */ @@ -14,12 +14,12 @@ #include <errno.h> #include "fetchmail.h" -struct hostrec cmd_opts; /* where to put command-line info */ -struct hostrec *hostlist; /* head of server list (globally visible) */ +struct query cmd_opts; /* where to put command-line info */ +struct query *querylist; /* head of server list (globally visible) */ int yydebug; /* in case we didn't generate with -- debug */ -static struct hostrec current; /* current server record */ +static struct query current; /* current server record */ static int prc_errflag; %} @@ -137,7 +137,7 @@ extern int prc_lineno; extern char *yytext; extern FILE *yyin; -static struct hostrec *hosttail; /* where to add new elements */ +static struct query *hosttail; /* where to add new elements */ int yyerror (s) /* report a syntax error */ @@ -191,7 +191,7 @@ prc_parse_file (pathname) char *pathname; /* pathname for the configuration file */ { prc_errflag = 0; - hostlist = hosttail = (struct hostrec *)NULL; + querylist = hosttail = (struct query *)NULL; prc_reset(); /* Check that the file is secure */ @@ -241,23 +241,23 @@ prc_reset() current.authenticate = saveauth; } -struct hostrec *hostalloc(init) +struct query *hostalloc(init) /* append a host record to the host list */ -struct hostrec *init; /* pointer to block containing initial values */ +struct query *init; /* pointer to block containing initial values */ { - struct hostrec *node; + struct query *node; /* allocate new node */ - node = (struct hostrec *) xmalloc(sizeof(struct hostrec)); + node = (struct query *) xmalloc(sizeof(struct query)); /* initialize it */ - memcpy(node, init, sizeof(struct hostrec)); + memcpy(node, init, sizeof(struct query)); /* append to end of list */ - if (hosttail != (struct hostrec *) 0) + if (hosttail != (struct query *) 0) hosttail->next = node; /* list contains at least one element */ else - hostlist = node; /* list is empty */ + querylist = node; /* list is empty */ hosttail = node; return(node); } @@ -292,8 +292,8 @@ int prc_register() void optmerge(h2, h1) /* merge two options records; empty fields in h2 are filled in from h1 */ -struct hostrec *h1; -struct hostrec *h2; +struct query *h1; +struct query *h2; { struct idlist *idp; @@ -64,12 +64,12 @@ static struct idlist *scratchlist; void initialize_saved_lists(hostlist, idfile) /* read file of saved IDs and attach to each host */ -struct hostrec *hostlist; +struct query *hostlist; char *idfile; { int st; FILE *tmpfp; - struct hostrec *hostp; + struct query *hostp; /* make sure lists are initially empty */ for (hostp = hostlist; hostp; hostp = hostp->next) @@ -93,7 +93,7 @@ char *idfile; } /* if it's not in a host we're querying, save it anyway */ - if (hostp == (struct hostrec *)NULL) + if (hostp == (struct query *)NULL) save_uid(&scratchlist, -1, buf); } } @@ -237,7 +237,7 @@ struct idlist **nidl; void update_uid_lists(hostp) /* perform end-of-query actions on UID lists */ -struct hostrec *hostp; +struct query *hostp; { free_uid_list(&hostp->oldsaved); hostp->oldsaved = hostp->newsaved; @@ -246,12 +246,12 @@ struct hostrec *hostp; void write_saved_lists(hostlist, idfile) /* perform end-of-run write of seen-messages list */ -struct hostrec *hostlist; +struct query *hostlist; char *idfile; { int st, idcount; FILE *tmpfp; - struct hostrec *hostp; + struct query *hostp; struct idlist *idp; /* if all lists are empty, nuke the file */ |