diff options
-rw-r--r-- | driver.c | 27 | ||||
-rw-r--r-- | fetchmail.c | 18 | ||||
-rw-r--r-- | fetchmail.h | 57 | ||||
-rw-r--r-- | options.c | 10 | ||||
-rw-r--r-- | rcfile_y.y | 10 |
5 files changed, 62 insertions, 60 deletions
@@ -63,7 +63,7 @@ extern char *strstr(); /* needed on sysV68 R3V7.1. */ int fetchlimit; /* how often to tear down the server connection */ int batchcount; /* count of messages sent in current batch */ -int peek_capable; /* can we peek for better error recovery? */ +bool peek_capable; /* can we peek for better error recovery? */ static const struct method *protocol; static jmp_buf restart; @@ -445,9 +445,9 @@ char *realname; /* real name of host */ int n, linelen, oldlen, ch, remaining; char *cp; struct idlist *idp, *xmit_names; - int good_addresses, bad_addresses, has_nuls; + bool good_addresses, bad_addresses, has_nuls; #ifdef HAVE_RES_SEARCH - int no_local_matches = FALSE; + bool no_local_matches = FALSE; #endif /* HAVE_RES_SEARCH */ int olderrs; @@ -1028,8 +1028,8 @@ static int readbody(sock, ctl, forward, len, delimited) struct query *ctl; /* query control record */ int sock; /* to which the server is connected */ int len; /* length of message */ -int forward; /* TRUE to forward */ -int delimited; /* does the protocol use a message delimiter? */ +bool forward; /* TRUE to forward */ +bool delimited; /* does the protocol use a message delimiter? */ { int linelen; char buf[MSGBUFSIZE+1], *cp; @@ -1167,7 +1167,7 @@ const struct method *proto; /* protocol method table */ void (*sigsave)(); #ifndef KERBEROS_V4 - if (ctl->server.authenticate == A_KERBEROS_V4) + if (ctl->server.preauthenticate == A_KERBEROS_V4) { error(0, -1, "Kerberos V4 support not linked."); return(PS_ERROR); @@ -1246,7 +1246,7 @@ const struct method *proto; /* protocol method table */ } #ifdef KERBEROS_V4 - if (ctl->server.authenticate == A_KERBEROS_V4) + if (ctl->server.preauthenticate == A_KERBEROS_V4) { ok = kerberos_auth(sock, ctl->server.canonical_name); if (ok != 0) @@ -1420,7 +1420,7 @@ const struct method *proto; /* protocol method table */ } else if (count > 0) { - int force_retrieval; + bool force_retrieval; /* * What forces this code is that in POP3 and IMAP2BIS you can't @@ -1449,11 +1449,11 @@ const struct method *proto; /* protocol method table */ /* read, forward, and delete messages */ for (num = 1; num <= count; num++) { - int toolarge = msgsizes && (msgsizes[num-1] > ctl->limit); - int fetch_it = ctl->fetchall || + bool toolarge = msgsizes && (msgsizes[num-1] > ctl->limit); + bool fetch_it = ctl->fetchall || (!toolarge && (force_retrieval || !(protocol->is_old && (protocol->is_old)(sock,ctl,num)))); - int suppress_delete = FALSE; - int suppress_forward = FALSE; + bool suppress_delete = FALSE; + bool suppress_forward = FALSE; /* we may want to reject this message if it's old */ if (!fetch_it) @@ -1475,7 +1475,8 @@ const struct method *proto; /* protocol method table */ if (outlevel > O_SILENT) { - int havesizes, mlen; + bool havesizes; + int mlen; error_build("reading message %d", num); diff --git a/fetchmail.c b/fetchmail.c index cc303530..222b2e84 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -57,18 +57,18 @@ int yydebug; /* enable parse debugging */ /* daemon mode control */ int poll_interval; /* poll interval in seconds */ -int nodetach; /* if TRUE, don't detach daemon process */ +bool nodetach; /* if TRUE, don't detach daemon process */ char *logfile; /* log file for daemon mode */ -int use_syslog; /* if --syslog was set */ -int quitmode; /* if --quit was set */ -int check_only; /* if --probe was set */ +bool use_syslog; /* if --syslog was set */ +bool quitmode; /* if --quit was set */ +bool check_only; /* if --probe was set */ char *cmd_logfile; /* if --logfile was set */ int cmd_daemon; /* if --daemon was set */ /* miscellaneous global controls */ char *rcfile; /* path name of rc file */ char *idfile; /* UID list file */ -int versioninfo; /* emit only version info */ +bool versioninfo; /* emit only version info */ char *user; /* the name of the invoking user */ char *fetchmailhost; /* the name of the host running fetchmail */ char *program_name; /* the name to prefix error messages with */ @@ -305,7 +305,7 @@ int main (int argc, char **argv) for (ctl = querylist; ctl; ctl = ctl->next) if (ctl->active && !(implicitmode && ctl->server.skip)&&!ctl->password) { - if (ctl->server.authenticate == A_KERBEROS_V4 || ctl->server.protocol == P_IMAP_K4) + if (ctl->server.preauthenticate == A_KERBEROS_V4 || ctl->server.protocol == P_IMAP_K4) /* Server won't care what the password is, but there must be some non-null string here. */ ctl->password = ctl->remotename; @@ -405,7 +405,7 @@ int main (int argc, char **argv) * as a probe to make sure our nameserver is still up. * The multidrop case (especially) needs it. */ - if (ctl->server.authenticate==A_KERBEROS_V4 || MULTIDROP(ctl)) + if (ctl->server.preauthenticate==A_KERBEROS_V4 || MULTIDROP(ctl)) { struct hostent *namerec; @@ -859,7 +859,7 @@ void dump_params (struct query *ctl) printf(" Password = '%s'.\n", visbuf(ctl->password)); if (ctl->server.protocol == P_POP3 && ctl->server.port == KPOP_PORT - && ctl->server.authenticate == A_KERBEROS_V4) + && ctl->server.preauthenticate == A_KERBEROS_V4) printf(" Protocol is KPOP"); else printf(" Protocol is %s", showproto(ctl->server.protocol)); @@ -871,7 +871,7 @@ void dump_params (struct query *ctl) printf(" (forcing UIDL use)"); putchar('.'); putchar('\n'); - if (ctl->server.authenticate == A_KERBEROS_V4) + if (ctl->server.preauthenticate == A_KERBEROS_V4) printf(" Kerberos V4 preauthentication enabled.\n"); printf(" Server nonresponse timeout is %d seconds", ctl->server.timeout); if (ctl->server.timeout == CLIENT_TIMEOUT) diff --git a/fetchmail.h b/fetchmail.h index 689a5843..010ccd9c 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -14,7 +14,7 @@ #define KPOP_PORT 1109 -/* authentication types */ +/* preauthentication types */ #define A_PASSWORD 0 /* password or inline authentication */ #define A_KERBEROS_V4 1 /* preauthenticate w/ Kerberos V4 */ @@ -64,21 +64,22 @@ struct idlist struct idlist *next; }; +typedef int bool; 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; - int port; - int interval; - int authenticate; - int timeout; - char *envelope; - int skip; - int dns; - int uidl; + int protocol; /* protocol type */ + int port; /* TCP/IP service port number */ + int interval; /* # cycles to skip between polls */ + int preauthenticate; /* preauthentication mode to try */ + int timeout; /* inactivity timout in seconds */ + char *envelope; /* envelope address list header */ + bool skip; /* skip this server? */ + bool dns; /* do DNS lookup on multidrop? */ + bool uidl; /* use RFC1725 UIDLs? */ #ifdef linux char *interface; @@ -113,21 +114,21 @@ struct query char *preconnect; /* per-user control flags */ - int keep; - int fetchall; - int flush; - int rewrite; - int stripcr; - int forcecr; - int limit; - int fetchlimit; - int batchlimit; + bool keep; + bool fetchall; + bool flush; + bool rewrite; + bool stripcr; + bool forcecr; + bool limit; + bool fetchlimit; + bool batchlimit; /* unseen, previous state of mailbox (initially from .fetchids) */ struct idlist *oldsaved, *newsaved; /* internal use */ - int active; + bool active; int errcount; /* count transient errors in last pass */ struct query *next; /* next query control block in chain */ int smtp_socket; /* socket descriptor for SMTP connection */ @@ -142,8 +143,8 @@ struct method { char *name; /* protocol name */ int port; /* service port */ - int tagged; /* if true, generate & expect command tags */ - int delimited; /* if true, accept "." message delimiter */ + bool tagged; /* if true, generate & expect command tags */ + bool delimited; /* if true, accept "." message delimiter */ int (*parse_response)(); /* response_parsing function */ int (*getauth)(); /* authorization fetcher */ int (*getrange)(); /* get message range to fetch */ @@ -168,23 +169,23 @@ extern int yydebug; /* enable parse debugging */ /* daemon mode control */ extern int poll_interval; /* poll interval in seconds */ -extern int nodetach; /* if TRUE, don't detach daemon process */ +extern bool nodetach; /* if TRUE, don't detach daemon process */ extern char *logfile; /* log file for daemon mode */ -extern int use_syslog; /* if --syslog was set */ -extern int quitmode; /* if --quit was set */ -extern int check_only; /* if --check was set */ +extern bool use_syslog; /* if --syslog was set */ +extern bool quitmode; /* if --quit was set */ +extern bool check_only; /* if --check was set */ extern char *cmd_logfile; /* if --logfile was set */ extern int cmd_daemon; /* if --daemon was set */ /* these get computed */ extern int batchcount; /* count of messages sent in current batch */ -extern int peek_capable; /* can we read msgs without setting seen? */ +extern bool peek_capable; /* can we read msgs without setting seen? */ /* miscellaneous global controls */ extern char *rcfile; /* path name of rc file */ extern char *idfile; /* path name of UID file */ extern int linelimit; /* limit # lines retrieved per site */ -extern int versioninfo; /* emit only version info */ +extern bool versioninfo; /* emit only version info */ extern char *user; /* name of invoking user */ extern char *fetchmailhost; /* the name of the host running fetchmail */ @@ -186,7 +186,7 @@ struct query *ctl; /* option record to be initialized */ { ctl->server.protocol = P_POP3; ctl->server.port = KPOP_PORT; - ctl->server.authenticate = A_KERBEROS_V4; + ctl->server.preauthenticate = A_KERBEROS_V4; } else if (strcasecmp(optarg,"imap") == 0) ctl->server.protocol = P_IMAP; @@ -212,13 +212,13 @@ struct query *ctl; /* option record to be initialized */ case 'A': case LA_AUTHENTICATE: if (strcmp(optarg, "password") == 0) - ctl->server.authenticate = A_PASSWORD; + ctl->server.preauthenticate = A_PASSWORD; else if (strcmp(optarg, "kerberos") == 0) - ctl->server.authenticate = A_KERBEROS_V4; + ctl->server.preauthenticate = A_KERBEROS_V4; else if (strcmp(optarg, "kerberos_v4") == 0) - ctl->server.authenticate = A_KERBEROS_V4; + ctl->server.preauthenticate = A_KERBEROS_V4; else { - fprintf(stderr,"Invalid authentication `%s' specified.\n", optarg); + fprintf(stderr,"Invalid preauthentication `%s' specified.\n", optarg); errflag++; } break; @@ -120,15 +120,15 @@ serv_option : AKA alias_list | PROTOCOL PROTO {current.server.protocol = $2;} | PROTOCOL KPOP { current.server.protocol = P_POP3; - current.server.authenticate = A_KERBEROS_V4; + current.server.preauthenticate = A_KERBEROS_V4; current.server.port = KPOP_PORT; } | UIDL {current.server.uidl = FLAG_TRUE;} | NO UIDL {current.server.uidl = FLAG_FALSE;} | PORT NUMBER {current.server.port = $2;} | INTERVAL NUMBER {current.server.interval = $2;} - | AUTHENTICATE PASSWORD {current.server.authenticate = A_PASSWORD;} - | AUTHENTICATE KERBEROS4 {current.server.authenticate = A_KERBEROS_V4;} + | AUTHENTICATE PASSWORD {current.server.preauthenticate = A_PASSWORD;} + | AUTHENTICATE KERBEROS4 {current.server.preauthenticate = A_KERBEROS_V4;} | TIMEOUT NUMBER {current.server.timeout = $2;} | ENVELOPE STRING {current.server.envelope = xstrdup($2);} | INTERFACE STRING { @@ -384,7 +384,7 @@ static void record_current(void) FLAG_FORCE(server.protocol); FLAG_FORCE(server.port); FLAG_FORCE(server.interval); - FLAG_FORCE(server.authenticate); + FLAG_FORCE(server.preauthenticate); FLAG_FORCE(server.timeout); FLAG_FORCE(server.envelope); FLAG_FORCE(server.skip); @@ -432,7 +432,7 @@ void optmerge(struct query *h2, struct query *h1) FLAG_MERGE(server.protocol); FLAG_MERGE(server.port); FLAG_MERGE(server.interval); - FLAG_MERGE(server.authenticate); + FLAG_MERGE(server.preauthenticate); FLAG_MERGE(server.timeout); FLAG_MERGE(server.envelope); FLAG_MERGE(server.skip); |