diff options
-rw-r--r-- | Makefile.in | 8 | ||||
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | README | 6 | ||||
-rw-r--r-- | fetchmail.c | 3 | ||||
-rw-r--r-- | fetchmail.man | 40 | ||||
-rw-r--r-- | pop2.c | 6 | ||||
-rw-r--r-- | pop3.c | 4 | ||||
-rw-r--r-- | socket.c | 6 |
8 files changed, 46 insertions, 31 deletions
diff --git a/Makefile.in b/Makefile.in index e801cc1e..4c9c710c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -62,15 +62,15 @@ TEXI2DVI = texi2dvi ETAGS = etags -tw CTAGS = ctags -tw -popobjs = socket.o getpass.o pop2.o pop3.o popclient.o options.o \ +popobjs = socket.o getpass.o pop2.o pop3.o imap.o popclient.o options.o \ poprc_l.o poprc_y.o poprc.o daemon.o xmalloc.o objs = $(popobjs) $(EXTRAOBJ) $(extras) srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \ - $(srcdir)/pop3.c $(srcdir)/popclient.c $(srcdir)/options.c \ - $(srcdir)/poprc.c $(srcdir)/daemon.c $(srcdir)/xmalloc.c \ - $(EXTRASRC) + $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/popclient.c \ + $(srcdir)/options.c $(srcdir)/poprc.c $(srcdir)/daemon.c \ + $(srcdir)/xmalloc.c $(EXTRASRC) .SUFFIXES: .SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi @@ -8,14 +8,14 @@ Option to enable EMACS-like user folder versioning on each run. S/key for secure challenge-response. -Implement IMAP support. - 3.1: * MDA arguments are now dumped when using the -V option. * Sendmail delivery from background seems to work now. +* We have IMAP2bis/IMAP4 suppport. + 3.05: * Experimental support for RFC1725-compliant POP servers with the UIDL @@ -1,7 +1,7 @@ README for popclient 3.0 -popclient is a full-featured, robust, well-documented POP2, POP3 and -APOP client originally developed by Carl Harris <ceharris@mal.com> and +popclient is a full-featured, robust, well-documented POP2, POP3, APOP, +and IMAP client originally developed by Carl Harris <ceharris@mal.com> and now maintained by Eric S. Raymond <esr@thyrsus.com>. You can find the latest version of popclient from Eric's home page @@ -10,7 +10,7 @@ You can find the latest version of popclient from Eric's home page Features of POP include: - * POP2, POP3 and APOP support + * POP2, POP3, APOP and IMAP support * Easy configuration via command line or free-format .poprc file. diff --git a/fetchmail.c b/fetchmail.c index 99a81e68..15d966b3 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -290,6 +290,9 @@ struct hostrec *queryctl; case P_APOP: return(doPOP3(queryctl)); break; + case P_IMAP: + return(doIMAP(queryctl)); + break; default: fprintf(stderr,"popclient: unsupported protocol selected.\n"); return(PS_PROTOCOL); diff --git a/fetchmail.man b/fetchmail.man index f6eeca3e..955b75d7 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -3,18 +3,20 @@ .\" For license terms, see the file COPYING in this directory. .TH popclient LOCAL .SH NAME -popclient \- retrieve mail from a mailserver using Post Office Protocol. +popclient \- retrieve mail from a mailserver using POP or IMAP .SH SYNOPSIS .B popclient [\fI options \fR] \fI [server-host...]\fR .SH DESCRIPTION .I popclient -is a Post Office Protocol compliant mail retrieval client which supports -both POP2 (as specified in RFC 937) and POP3 (RFC 1725). +is a mail retrieval client which supports +POP2 (as specified in RFC 937), POP3 (RFC 1725), IMAP2bis (as +implemented by the 4.4BSD imapd program), and IMAP4 (RFC1730). .PP -Typically, +The, .I popclient -will be used to download mail in batch from the remote mailserver specified by +program may be used to download mail in batch from the remote +mailserver specified by .I host to a mail folder on the local disk. The retrieved mail can then be manipulated using a local mail reader, such as @@ -39,7 +41,7 @@ Each server name that you specify (following the options on the command line) will be queried. If you don't specify any servers on the command line, each server in your .I ~/.poprc -file will be operated on. +file will be queried. .TP .B \-2 Use Post Office Protocol version 2 (POP2). See also the @@ -91,8 +93,9 @@ is compiled with the KEEP_IS_DEFAULT option, the option forces retrieved mail to be deleted. .TP .B \-l lines, --limit lines -POP3 only. Retrieve no more than the specified number of lines of each -message body (plus message headers). The +POP3 and IMAP only. Retrieve no more than the specified number of +lines (POP3) or characters (IMAP) of each message body (plus message +headers). The .B keep option is implied by the .B limit @@ -113,6 +116,8 @@ mailserver. .I proto may be one of the following: .RS +.IP IMAP +IMAP2bis, a compatible subset of IMAP4. .IP POP2 Post Office Protocol 2 .IP POP3 @@ -136,11 +141,12 @@ is specified, retrieved messages are appended to the system default mail folder. See OUTPUT OPTIONS below for a complete description. .TP .B \-r folder, --remote folder -Causes an alternate mail folder on the mailserver to be retrieved. The -syntax of the folder name is server dependent, as is the default behavior -when no folder is specified. Fortunately, most POP servers have a reasonable -default behavior, so use of this option should be limited to fairly specialized -applications. POP3 does not provide a folder specification in the protocol. +Causes an alternate mail folder on the mailserver to be retrieved. +The syntax of the folder name is server dependent, as is the default +behavior when no folder is specified. Fortunately, most POP2 and IMAP +servers have a reasonable default behavior, so use of this option +should be limited to fairly specialized applications. POP3 does not +provide a folder specification in the protocol. If the .B remote option is used in conjunction with the POP3 protocol, the remote folder @@ -529,9 +535,9 @@ queries more than one host, the returned status is that of the last host queried. .SH AUTHOR .I popclient -was written by Carl Harris at Virginia Polytechnic Institute and State +was originated by Carl Harris at Virginia Polytechnic Institute and State University (a.k.a. Virginia Tech). Version 3.0 was extensively improved -by Eric S. Raymond <esr@snark.thyrsus.com> and is now maintained by esr.. +by Eric S. Raymond <esr@snark.thyrsus.com> and is now maintained by esr. .PP .SH FILES .TP 5 @@ -542,10 +548,12 @@ default location of file associating hosts with last message IDs seen (used only with newer RFC1725-compliant servers supporting the UIDL command). .SH BUGS .PP +The --remotefolder option doesn't work with POP3. +.PP The UIDL support for RFC1725-compliant servers without LAST is not yet very well tested. .PP -No IMAP or RPOP support yet. +No RPOP support yet. .PP Send comments, bug reports, gripes, and the like to Eric S. Raymond <esr@thyrsus.com>. @@ -308,7 +308,7 @@ int socket; char buf [POPBUFSIZE]; /* read the greeting from the server */ - if (SockGets(socket, buf, sizeof(buf)) == 0) { + if (SockGets(socket, buf, sizeof(buf)) >= 0) { /* echo the server's greeting to the user */ if (outlevel > O_SILENT) @@ -353,7 +353,7 @@ int socket; char buf [POPBUFSIZE]; /* read the NMBR (#ccc) message from the server */ - if (SockGets(socket, buf, sizeof(buf)) == 0) { + if (SockGets(socket, buf, sizeof(buf)) >= 0) { /* is the message in the proper format? */ if (*buf == '#') { @@ -402,7 +402,7 @@ int socket; char buf [POPBUFSIZE]; /* read the SIZE message (=ccc) from the server */ - if (SockGets(socket, buf, sizeof(buf)) == 0) + if (SockGets(socket, buf, sizeof(buf)) >= 0) /* is the message in the correct format? */ if (*buf == '=') { msgsize = atoi(buf + 1); @@ -145,7 +145,7 @@ struct hostrec *queryctl; */ if (use_uidl && queryctl->lastid[0]) { if ((ok = POP3_sendUIDL(-1, socket, 0)) == 0) { - while (SockGets(socket, buf, sizeof(buf)) == 0) { + while (SockGets(socket, buf, sizeof(buf)) >= 0) { if (outlevel == O_VERBOSE) fprintf(stderr,"%s\n",buf); if (strcmp(buf, ".\n") == 0) { @@ -325,7 +325,7 @@ int socket; char buf [POPBUFSIZE]; char *bufp; - if (SockGets(socket, buf, sizeof(buf)) == 0) { + if (SockGets(socket, buf, sizeof(buf)) >= 0) { if (outlevel == O_VERBOSE) fprintf(stderr,"%s\n",buf); @@ -76,17 +76,21 @@ int socket; char *buf; int len; { + int rdlen = 0; + while (--len) { if (SockInternalRead(socket, buf, 1) != 1) return -1; + else + rdlen++; if (*buf == '\n') break; if (*buf != '\r') /* remove all CRs */ buf++; } *buf = 0; - return 0; + return rdlen; } int SockPuts(socket,buf) |