diff options
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | driver.c | 31 | ||||
-rw-r--r-- | fetchmail.c | 5 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | fetchmail.man | 38 | ||||
-rw-r--r-- | rcfile_l.l | 1 | ||||
-rw-r--r-- | sample.rcfile | 1 | ||||
-rw-r--r-- | smtp.c | 1 | ||||
-rw-r--r-- | smtp.h | 1 | ||||
-rw-r--r-- | uid.c | 2 |
12 files changed, 64 insertions, 26 deletions
diff --git a/Makefile.in b/Makefile.in index fb7ca131..40b7449c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -77,14 +77,14 @@ TEXI2DVI = texi2dvi ETAGS = etags -tw CTAGS = ctags -tw -protobjs = socket.o getpass.o pop2.o pop3.o imap.o fetchmail.o options.o \ +protobjs = socket.o getpass.o pop2.o pop3.o imap.o etrn.o fetchmail.o options.o \ rcfile_l.o rcfile_y.o daemon.o smtp.o driver.o rfc822.o xmalloc.o \ uid.o mxget.o md5c.o md5ify.o interface.o netrc.o error.o objs = $(protobjs) $(extras) $(EXTRAOBJ) srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \ - $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/fetchmail.c \ + $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/imap.c $(srcdir)/etrn.c \ $(srcdir)/options.c $(srcdir)/daemon.c $(srcdir)/driver.c \ $(srcdir)/rfc822.c $(srcdir)/smtp.c $(srcdir)/xmalloc.c \ $(srcdir)/uid.c $(srcdir)/mxget.c $(srcdir)/md5c.c \ @@ -5,6 +5,8 @@ fetchmail-3.4 () features -- +* Support for ESMTP ETRN extension. + bugs -- * The bug that displayed incorrect sizes for POP3 connections has been fixed. @@ -21,6 +21,8 @@ Since 3.0: ** Support for ESMTP 8BITMIME and SIZE options. + ** Support for ESMTP ETRN command. + ** The stripcr option to explicitly control carriage-return stripping before mail forwarding. @@ -1199,19 +1199,22 @@ const struct method *proto; /* protocol method table */ strcpy(realname, ctl->server.names->id); /* try to get authorized to fetch mail */ - shroud = ctl->password; - ok = (protocol->getauth)(sockfp, ctl, buf); - shroud = (char *)NULL; - if (ok == PS_ERROR) - ok = PS_AUTHFAIL; - if (ok != 0) + if (protocol->getauth) { - error(0, 0, "Authorization failure on %s@%s", - ctl->remotename, - realname); - goto cleanUp; + shroud = ctl->password; + ok = (protocol->getauth)(sockfp, ctl, buf); + shroud = (char *)NULL; + if (ok == PS_ERROR) + ok = PS_AUTHFAIL; + if (ok != 0) + { + error(0, 0, "Authorization failure on %s@%s", + ctl->remotename, + realname); + goto cleanUp; + } + vtalarm(ctl->server.timeout); } - vtalarm(ctl->server.timeout); /* compute number of messages and number of new messages waiting */ ok = (protocol->getrange)(sockfp, ctl, &count, &new); @@ -1221,7 +1224,11 @@ const struct method *proto; /* protocol method table */ /* show user how many messages we downloaded */ if (outlevel > O_SILENT) - if (count == 0) + if (count == -1) /* only used for ETRN */ + error(0, 0, "Polling %s@%s", + ctl->remotename, + realname); + else if (count == 0) error(0, 0, "No mail at %s@%s", ctl->remotename, realname); diff --git a/fetchmail.c b/fetchmail.c index 1a2dc8dc..111a52d2 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -300,7 +300,7 @@ int main (int argc, char **argv) } } - if (!ctl->password) + if (ctl->server.protocol != P_ETRN && !ctl->password) { (void) sprintf(tmpbuf, "Enter password for %s@%s: ", ctl->remotename, ctl->server.names->id); @@ -709,6 +709,7 @@ static char *showproto(int proto) case P_IMAP: return("IMAP"); break; case P_APOP: return("APOP"); break; case P_RPOP: return("RPOP"); break; + case P_ETRN: return("ETRN"); break; default: return("unknown?!?"); break; } } @@ -753,6 +754,8 @@ static int query_host(struct query *ctl) case P_IMAP: return(doIMAP(ctl)); break; + case P_ETRN: + return(doETRN(ctl)); default: error(0, 0, "unsupported protocol selected."); return(PS_PROTOCOL); diff --git a/fetchmail.h b/fetchmail.h index 4f974b45..c43bfee2 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -9,6 +9,7 @@ #define P_IMAP 4 #define P_APOP 5 #define P_RPOP 6 +#define P_ETRN 7 #define KPOP_PORT 1109 @@ -199,6 +200,7 @@ int do_protocol(struct query *, const struct method *); int doPOP2 (struct query *); int doPOP3 (struct query *); int doIMAP (struct query *); +int doETRN (struct query *); void reply_hack(char *, const char *); char *nxtaddr(const char *); diff --git a/fetchmail.man b/fetchmail.man index 24495d98..64892b26 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -82,9 +82,10 @@ options are set the way you want them. .B \-c, --check Return a status code to indicate whether there is mail waiting, without actually fetching or deleting mail (see EXIT CODES below). -This option doesn't play well with queries to multiple sites, and -is ignored in daemon mode. It's also prone to false positives if -you leave read but undeleted mail in your server mailbox. +This option doesn't play well with queries to multiple sites, doen't +work with ETRN, and is ignored in daemon mode. It's also prone to +false positives if you leave read but undeleted mail in your server +mailbox. .TP .B \-s, --silent Silent mode. Suppresses all progress/status messages that are normally @@ -100,23 +101,25 @@ and the mailserver are echoed to stderr. Overrides --silent. Retrieve both old (seen) and new messages from the mailserver. The default is to fetch only messages the server has not marked seen. Note that POP2 retrieval behaves as though --all is always on (see -RETRIEVAL FAILURE MODES below). +RETRIEVAL FAILURE MODES below) and this option does not work with ETRN. .TP .B \-k, --keep Keep retrieved messages on the remote mailserver. Normally, messages are deleted from the folder on the mailserver after they have been retrieved. Specifying the .B keep -option causes retrieved messages to remain in your folder on the mailserver. +option causes retrieved messages to remain in your folder on the +mailserver. This option does not work with ETRN. .TP .B \-K, --kill Delete retrieved messages from the remote mailserver. This option forces retrieved mail to be deleted. It may be useful if -you have specified a default of \fBnokill\fR in your \fI.fetchmailrc\fR. +you have specified a default of \fBnokill\fR in your +\fI.fetchmailrc\fR. This option is forced on with ETRN. .TP .B \-F, --flush POP3/IMAP only. Delete old (previously retrieved) messages from the mailserver -before retrieving new messages. +before retrieving new messages. This option does not work with ETRN. .SS Protocol and Query Options .TP .B \-p, \--protocol proto @@ -140,6 +143,8 @@ Use POP3 with MD5 authentication. Use POP3 with RPOP authentication. .IP KPOP Use POP3 with Kerberos authentication on port 1109. +.IP ETRN +Use the ESMTP ETRN option. .RE .TP .B \-P, --port @@ -151,7 +156,7 @@ well-established default port numbers. Causes a specified non-default 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. This option is not available -under POP3. +under POP3 or ETRN. .SS Delivery Control Options .TP .B \-S host, --smtphost host @@ -179,6 +184,7 @@ they are "oversized"). The --all option overrides this one. This option is intended for those needing to strictly control fetch time in interactive mode. It may not be used with daemon mode, as users would never receive a notification that messages were waiting. +This option does not work with ETRN. .TP .B -b, --batchlimit Specify the maximum number of messages that will be shipped to an SMTP @@ -191,6 +197,7 @@ shut down to deliver. This may produce annoying delays when .IR fetchmail (8) is processing very large batches. Setting the batch limit to some nonzero size will prevent these delays. +This option does not work with ETRN. .TP .B -B, --fetchlimit Limit the number of messages accepted from a given server in a single @@ -243,6 +250,7 @@ primarily for developers; choosing KPOP protocol automatically selects Kerberos authentication, and all other alternatives use ordinary password authentication (though APOP uses a generated one-time key as the password). +This option does not work with ETRN. .SS Miscellaneous Options .TP .B \-f pathname, --fetchmailrc pathname @@ -266,6 +274,7 @@ client machine!). This option disables the rewrite. (This option is provided to pacify people who are paranoid about having an MTA edit mail headers and want to know they can prevent it, but it is generally not a good idea to actually turn off rewrite.) +When using ETRN, the rewrite option is ineffective. .TP .B -E, --envelope This option changes the header @@ -275,6 +284,7 @@ this is `X-Envelope-To' but as this header is not standard, practice varies. See the discussion of multidrop address handling below. .SH USER AUTHENTICATION +Every mode except ETRN requires authentication of the client. Normal user authentication in .I fetchmail is very much like the authentication mechanism of @@ -501,6 +511,10 @@ RFCs. If you ever trip over a server that doesn't, the symptom will be that messages you have already read on your host will look new to the server. In this (unlikely) case, only messages you fetched with \fIfetchmail --keep\fR will be both undeleted and marked old. +.PP +In ETRN mode, \fIfetchmail\fR does not actually retrieve messages; +instead, it asks the server's SMTP listener to start a queue flush +to the client via SMTP. Therefore it sends only undelivered messages. .SH SPAM FILTERING Newer versions of @@ -813,6 +827,7 @@ listener without modification. Be careful of mail loops if you do this! .SH THE USE AND ABUSE OF MULTIDROP MAILBOXES Use the multiple-local-recipients feature with caution -- it can bite. +Also note that all multidrop features are ineffective in ETRN mode. .SS Header vs. Envelope addresses The fundamental problem is that by having your mailserver toss several @@ -996,7 +1011,7 @@ correctly set, or that \fBgetpwuid\fR(3) be able to retrieve a password entry from your user ID. .SH BUGS AND KNOWN PROBLEMS -Use of any of the supported protocols other than APOP or KPOP requires +Use of any of the supported protocols other than APOP, KPOP, or ETRN requires that the program send unencrypted passwords over the TCP/IP connection to the mailserver. This creates a risk that name/password pairs might be snaffled with a packet sniffer or more sophisticated @@ -1035,4 +1050,7 @@ IMAP2/IMAP2BIS: RFC 1176, RFC 1732 .TP 5 IMAP4: -RFC 1730, RFC 1731, RFC 1732, RFC 2060
\ No newline at end of file +RFC 1730, RFC 1731, RFC 1732, RFC 2060 +.TP 5 +ETRN: +RFC 1985 @@ -83,6 +83,7 @@ options {/* EMPTY */} (pop3)|(POP3) { yylval.proto = P_POP3; return PROTO; } (imap)|(IMAP) { yylval.proto = P_IMAP; return PROTO; } (apop)|(APOP) { yylval.proto = P_APOP; return PROTO; } +(etrn)|(ETRN) { yylval.proto = P_ETRN; return PROTO; } (kpop)|(KPOP) { return KPOP; } diff --git a/sample.rcfile b/sample.rcfile index c4164e26..995f4bb5 100644 --- a/sample.rcfile +++ b/sample.rcfile @@ -62,6 +62,7 @@ # apop (or APOP) # rpop (or RPOP) # kpop (or KPOP) +# etrn (or ETRN) # # Legal authentication types are # login @@ -27,6 +27,7 @@ static struct opt extensions[] = { {"8BITMIME", ESMTP_8BITMIME}, {"SIZE", ESMTP_SIZE}, + {"ETRN", ESMTP_ETRN}, {(char *)NULL, 0}, }; @@ -17,6 +17,7 @@ /* ESMTP extension option masks (not all options are listed here) */ #define ESMTP_8BITMIME 0x01 #define ESMTP_SIZE 0x02 +#define ESMTP_ETRN 0x04 int SMTP_helo(FILE *sockfp,char *host); int SMTP_ehlo(FILE *sockfp,char *host,int *opt); @@ -145,7 +145,7 @@ void save_str_pair(struct idlist **idl, const char *str1, const char *str2) (*end)->val.id2 = xstrdup(str2); else (*end)->val.id2 = (char *)NULL; - (*end)->next = (char *)NULL; + (*end)->next = (struct idlist *)NULL; } #ifdef __UNUSED__ |