diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1996-09-28 13:31:48 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1996-09-28 13:31:48 +0000 |
commit | 0bcddca0b9aebb44d6076cf12c93f316463dd310 (patch) | |
tree | 91e773d44b6034d656cb8206b3647e0b42176ca8 | |
parent | 13e2bb7fa077c96437eb9cbdfd75731af7174261 (diff) | |
download | fetchmail-0bcddca0b9aebb44d6076cf12c93f316463dd310.tar.gz fetchmail-0bcddca0b9aebb44d6076cf12c93f316463dd310.tar.bz2 fetchmail-0bcddca0b9aebb44d6076cf12c93f316463dd310.zip |
Give up on POP3 UIDs, they're a dead loss.
svn path=/trunk/; revision=173
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | NEWS | 10 | ||||
-rw-r--r-- | fetchmail.c | 27 | ||||
-rw-r--r-- | fetchmail.h | 19 | ||||
-rw-r--r-- | fetchmail.man | 8 | ||||
-rw-r--r-- | options.c | 34 | ||||
-rw-r--r-- | pop3.c | 84 |
7 files changed, 23 insertions, 163 deletions
diff --git a/Makefile.in b/Makefile.in index e7073bba..5bd5c597 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,7 +72,7 @@ ETAGS = etags -tw CTAGS = ctags -tw popobjs = socket.o getpass.o pop2.o pop3.o imap.o fetchmail.o options.o \ - rcfile_l.o rcfile_y.o rcfile.o daemon.o driver.o smtp.o xmalloc.o uid.o + rcfile_l.o rcfile_y.o rcfile.o daemon.o driver.o smtp.o xmalloc.o objs = $(popobjs) $(EXTRAOBJ) $(extras) @@ -80,7 +80,7 @@ srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \ $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/fetchmail.c \ $(srcdir)/options.c $(srcdir)/rcfile.c $(srcdir)/daemon.c \ $(srcdir)/driver.c $(srcdir)/smtp.c $(srcdir)/xmalloc.c \ - $(srcdir)/uid.c $(EXTRASRC) + $(EXTRASRC) .SUFFIXES: .SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi @@ -1,19 +1,23 @@ To-do list: -Torture-test RPOP and RFC1725 POP UIDL features against a server that has them. +Test RPOP feature against a server that has it. Support IMAP4 extensions for secure challenge-response, once they're actually standardized. Also, use the CAPABILITY command to detect when we're talking to a true IMAP4 server and use SEARCH UNSEEN. +Inflict pain on the person(s) responsible for removing LAST from POP3. + Release Notes: -fetchmail-1.0 (): +fetchmail-1.1 (Sat Sep 28 09:21:10 EDT 1996): * In POP3, don't send LAST if STAT shows count of waiting messages to be zero. * Document APOP better, we know it works now. +* Lose the .fetchids file and give up on POP3 UIDs, they're a dead loss. + fetchmail-1.0 (Thu Sep 26 11:59:38 EDT 1996): * SMTP forwarding and header-rewrite features work with POP2 now. @@ -25,7 +29,7 @@ fetchmail-1.0 (Thu Sep 26 11:59:38 EDT 1996): server greeting message; add the server host being queried to the message count information line). -* `skip' option to make it easier to set up test entries. +* Add `skip' option to make it easier to set up test entries. * Name change (it ain't just for POP any more). diff --git a/fetchmail.c b/fetchmail.c index 41e07cfa..e760c17e 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -145,12 +145,6 @@ char **argv; strcat(tmpbuf, user); } - /* initialize UID handling */ - if ((st = prc_filecheck(idfile)) != 0) - exit(st); - else - initialize_saved_lists(hostlist, idfile); - /* perhaps we just want to check options? */ if (versioninfo) { printf("Taking options from command line and %s\n", rcfile); @@ -247,10 +241,7 @@ char **argv; do { for (hostp = hostlist; hostp; hostp = hostp->next) { if (!implicitmode || !hostp->skip) - { popstatus = query_host(hostp); - update_uid_lists(hostp); - } } sleep(poll_interval); @@ -270,8 +261,6 @@ void termhook(int sig) if (sig != 0) fprintf(stderr, "terminated with signal %d\n", sig); - write_saved_lists(hostlist, idfile); - unlink(lockfile); exit(popstatus); } @@ -453,22 +442,6 @@ struct hostrec *queryctl; else printf(" Text retrieved per message will be at most %d bytes.\n", linelimit); - if (queryctl->protocol > P_POP2) - if (!queryctl->saved) - printf(" No UIDs saved from this host.\n"); - else - { - struct idlist *idp; - int count = 0; - - for (idp = hostp->saved; idp; idp = idp->next) - ++count; - - printf(" %d UIDs saved.\n", count); - if (outlevel == O_VERBOSE) - for (idp = hostp->saved; idp; idp = idp->next) - fprintf(stderr, "\t%s %s\n", hostp->servername, idp->id); - } } /********************************************************************* diff --git a/fetchmail.h b/fetchmail.h index 12aaf11e..1f29c921 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -56,13 +56,6 @@ #define SIZETICKER 1024 /* print 1 dot per this many bytes */ -struct idlist -{ - int num; - char *id; - struct idlist *next; -}; - struct hostrec { /* per-host data */ @@ -85,12 +78,8 @@ struct hostrec int norewrite; int skip; - /* previous state of mailbox (initially from .fetchids) */ - struct idlist *saved; - /* internal use */ struct hostrec *next; /* next host in chain */ - struct idlist *mailbox; /* current state of mailbox */ #if defined(HAVE_APOP_SUPPORT) char digest [DIGESTLEN]; #endif @@ -141,14 +130,6 @@ int doPOP2 (struct hostrec *); int doPOP3 (struct hostrec *); int doIMAP (struct hostrec *); -void initialize_saved_lists(struct hostrec *, char *); -void save_uid(struct idlist **, int, char *); -void free_uid_list(struct idlist **); -int delete_uid(struct idlist **, char *); -int uid_in_list(struct idlist **, char *); -void update_uid_lists(struct hostrec *); -void write_saved_lists(struct hostrec *, char *); - int parsecmdline (int, char **, struct hostrec *); int setdefaults (struct hostrec *); char *getnextserver (int argc, char **, int *); diff --git a/fetchmail.man b/fetchmail.man index c2f618af..a6278d8e 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -87,9 +87,6 @@ before retrieving new messages. .B \-f pathname, --fetchmailrc pathname Specify an alternate name for the .fetchmailrc run control file. .TP -.B \-i pathname, --idfile pathname -Specify an alternate name for the .fetchids file. -.TP .B \-k, --keep Keep retrieved messages in folder on remote mailserver. Normally, messages are deleted from the folder on the mailserver after they have been retrieved @@ -587,11 +584,6 @@ created by the new SMTP forwarding default. ~/.fetchmailrc default run control file .TP 5 -~/.fetchids -default location of file associating hosts with last message IDs seen -(used only with newer RFC1725-compliant POP3 servers supporting the -UIDL command). -.TP 5 ${TMPDIR}/fetchmail-${HOST}-${USER} lock file to help prevent concurrent runs. .SH ENVIRONMENT @@ -30,17 +30,16 @@ #define LA_PROTOCOL 10 #define LA_DAEMON 11 #define LA_RCFILE 12 -#define LA_IDFILE 13 -#define LA_USERNAME 14 -#define LA_REMOTEFILE 15 -#define LA_LOCALFILE 16 -#define LA_MDA 17 -#define LA_PORT 18 -#define LA_SMTPHOST 19 -#define LA_LOGFILE 20 -#define LA_QUIT 21 -#define LA_NOREWRITE 22 -#define LA_YYDEBUG 23 +#define LA_USERNAME 13 +#define LA_REMOTEFILE 14 +#define LA_LOCALFILE 15 +#define LA_MDA 16 +#define LA_PORT 17 +#define LA_SMTPHOST 18 +#define LA_LOGFILE 19 +#define LA_QUIT 20 +#define LA_NOREWRITE 21 +#define LA_YYDEBUG 22 static char *shortoptions = "23PVaKkvS:scl:Fd:f:u:r:o:m:L:qN"; static struct option longoptions[] = { @@ -65,7 +64,6 @@ static struct option longoptions[] = { {"port", required_argument, (int *) 0, LA_PORT }, {"smtphost", required_argument, (int *) 0, LA_SMTPHOST }, {"logfile", required_argument, (int *) 0, LA_LOGFILE }, - {"idfile", required_argument, (int *) 0, LA_IDFILE }, {"quit", no_argument, (int *) 0, LA_QUIT }, {"norewrite", no_argument, (int *) 0, LA_NOREWRITE }, {"yydebug", no_argument, (int *) 0, LA_YYDEBUG }, @@ -194,11 +192,6 @@ struct hostrec *queryctl; rcfile = (char *) xmalloc(strlen(optarg)+1); strcpy(rcfile,optarg); break; - case 'i': - case LA_IDFILE: - idfile = (char *) xmalloc(strlen(optarg)+1); - strcpy(idfile,optarg); - break; case 'u': case LA_USERNAME: strncpy(queryctl->remotename,optarg,sizeof(queryctl->remotename)-1); @@ -355,13 +348,6 @@ struct hostrec *queryctl; strcat(rcfile, "/"); strcat(rcfile, RCFILE_NAME); - idfile = - (char *) xmalloc(strlen(home)+strlen(IDFILE_NAME)+2); - - strcpy(idfile, home); - strcat(idfile, "/"); - strcat(idfile, IDFILE_NAME); - outlevel = O_NORMAL; return(0); @@ -142,8 +142,6 @@ badAuth: return(PS_ERROR); } -static int use_uidl; - static pop3_getrange(socket, queryctl, countp, firstp) /* get range of messages to be fetched */ int socket; @@ -164,78 +162,26 @@ int *firstp; /* * Newer, RFC-1725-conformant POP servers may not have the LAST command. - * Try LAST first as it simplifies life. If it fails, go through the - * contortions with UID lists required. - * - * We could reverse this order (checking for UID capabilities first), - * but if LAST works we can finish faster and do fewer mallocs. */ *firstp = 1; - use_uidl = 0; - if (*countp > 0 && !queryctl->fetchall) { + if (*countp > 0 && !queryctl->fetchall) + { char id [IDLEN+1]; int num; - /* try LAST first */ gen_send(socket,"LAST"); ok = pop3_ok(buf,socket); if (ok == 0 && sscanf(buf, "%d", &num) == 0) return(PS_ERROR); /* crucial fork in the road here */ - use_uidl = (ok != 0); - - if (!use_uidl) + if (ok != 0) *firstp = num + 1; - else - { - /* grab the mailbox's UID list */ - gen_send(socket, "UIDL"); - if ((ok = pop3_ok(buf, socket)) == 0) { - while (SockGets(socket, buf, sizeof(buf)) >= 0) { - if (outlevel == O_VERBOSE) - fprintf(stderr,"%s\n",buf); - if (strcmp(buf, ".\n") == 0) { - break; - } - if (sscanf(buf, "%d %s\n", &num, id) == 2) - save_uid(&queryctl->mailbox, num, id); - } - } - } } return(0); } -static pop3_is_old(socket, queryctl, number) -/* check a given message for age by UID */ -int socket; -struct hostrec *queryctl; -int number; -{ - if (!use_uidl) - return(0); - else - { - char buf [POPBUFSIZE+1]; - int ok; - - gen_send(socket, "UIDL %d", number); - if ((ok = pop3_ok(socket, buf)) != 0) - return(ok); - else - { - char id[IDLEN+1]; - - if (sscanf(buf, "%*d %s", id) == 2) - return(uid_in_list(&queryctl->saved, id)); - else - return(0); - } - } -} - static int pop3_fetch(socket, number, limit, lenp) /* request nth message */ int socket; @@ -261,28 +207,6 @@ int number; /* send the deletion request */ if ((ok = gen_transact(socket, "DELE %d", number)) != 0) return(ok); - - /* we may need to nuke the message's UID out of the mailbox list */ - if (use_uidl) - { - char buf [POPBUFSIZE+1]; - - /* - * This isn't strictly necessary. We should probably just - * stash the UID result from the last is_old call. - */ - gen_send(socket, "UIDL %d", number); - if ((ok = pop3_ok(socket, buf)) != 0) - return(ok); - else - { - char id[IDLEN+1]; - - if (sscanf(buf, "%*d %s", id) == 2) - delete_uid(&queryctl->mailbox, id); - return(0); - } - } } static struct method pop3 = @@ -294,7 +218,7 @@ static struct method pop3 = pop3_ok, /* parse command response */ pop3_getauth, /* get authorization */ pop3_getrange, /* query range of messages */ - pop3_is_old, /* check for age by UID */ + NULL, /* can't check for recent */ pop3_fetch, /* request given message */ NULL, /* no message trailer */ pop3_delete, /* how to delete a message */ |