diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2001-02-07 08:01:13 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2001-02-07 08:01:13 +0000 |
commit | 19580930369179181789233ab2f311530d65edf1 (patch) | |
tree | f70649ac43d90f258b6e6f89f306a4a5ad806a6c | |
parent | c08743b5ce697ba31f950f3d4590745c8cc67cbd (diff) | |
download | fetchmail-19580930369179181789233ab2f311530d65edf1.tar.gz fetchmail-19580930369179181789233ab2f311530d65edf1.tar.bz2 fetchmail-19580930369179181789233ab2f311530d65edf1.zip |
First cut at ODMR support.
svn path=/trunk/; revision=3028
-rw-r--r-- | Makefile.in | 23 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | README | 5 | ||||
-rw-r--r-- | acconfig.h | 3 | ||||
-rw-r--r-- | conf.c | 3 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | env.c | 3 | ||||
-rw-r--r-- | fetchmail-FAQ.html | 13 | ||||
-rw-r--r-- | fetchmail-features.html | 6 | ||||
-rw-r--r-- | fetchmail.c | 47 | ||||
-rw-r--r-- | fetchmail.h | 2 | ||||
-rw-r--r-- | fetchmail.man | 66 | ||||
-rwxr-xr-x | fetchmailconf | 18 | ||||
-rw-r--r-- | imap.c | 129 | ||||
-rw-r--r-- | rcfile_l.l | 1 | ||||
-rw-r--r-- | smtp.c | 3 | ||||
-rw-r--r-- | smtp.h | 1 |
17 files changed, 138 insertions, 193 deletions
diff --git a/Makefile.in b/Makefile.in index 65730bb1..cead2d1e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -95,8 +95,8 @@ ETAGS = etags CTAGS = ctags protobjs = rcfile_y.o rcfile_l.o socket.o getpass.o pop2.o pop3.o imap.o \ - etrn.o fetchmail.o idle.o env.o options.o daemon.o driver.o sink.o \ - rfc822.o smtp.o xmalloc.o uid.o mxget.o md5ify.o rpa.o \ + etrn.o odmr.o fetchmail.o idle.o env.o options.o daemon.o driver.o \ + sink.o rfc822.o smtp.o xmalloc.o uid.o mxget.o md5ify.o cram.o rpa.o \ interface.o netrc.o base64.o error.o unmime.o conf.o checkalias.o \ smbdes.o smbencrypt.o smbmd4.o smbutil.o ipv6-connect.o @@ -104,15 +104,16 @@ objs = $(protobjs) $(extras) $(EXTRAOBJ) srcs = $(srcdir)/socket.c $(srcdir)/getpass.c $(srcdir)/pop2.c \ $(srcdir)/pop3.c $(srcdir)/imap.c $(srcdir)/etrn.c \ - $(srcdir)/fetchmail.c $(srcdir)/env.c $(srcdir)/idle.c \ - $(srcdir)/options.c $(srcdir)/daemon.c $(srcdir)/driver.c \ - $(srcdir)/sink.c $(srcdir)/rfc822.c $(srcdir)/smtp.c \ - $(srcdir)/xmalloc.c $(srcdir)/uid.c $(srcdir)/mxget.c \ - $(srcdir)/md5ify.c $(srcdir)/rpa.c $(srcdir)/interface.c \ - $(srcdir)/netrc.c $(srcdir)/base64.c $(srcdir)/error.c \ - $(srcdir)/unmime.c $(srcdir)/conf.c $(srcdir)/checkalias.c \ - $(srcdir)/smbdes.c $(srcdir)/smbencrypt.c $(srcdir)/smbmd4.c \ - $(srcdir)/smbutil.c $(srcdir)/ipv6-connect.c + $(srcdir)/odmr.c $(srcdir)/fetchmail.c $(srcdir)/env.c \ + $(srcdir)/idle.c $(srcdir)/options.c $(srcdir)/daemon.c \ + $(srcdir)/driver.c $(srcdir)/sink.c $(srcdir)/rfc822.c \ + $(srcdir)/smtp.c $(srcdir)/xmalloc.c $(srcdir)/uid.c \ + $(srcdir)/mxget.c $(srcdir)/md5ify.c $(srcdir)/cram.c \ + $(srcdir)/rpa.c $(srcdir)/interface.c $(srcdir)/netrc.c \ + $(srcdir)/base64.c $(srcdir)/error.c $(srcdir)/unmime.c \ + $(srcdir)/conf.c $(srcdir)/checkalias.c $(srcdir)/smbdes.c \ + $(srcdir)/smbencrypt.c $(srcdir)/smbmd4.c $(srcdir)/smbutil.c \ + $(srcdir)/ipv6-connect.c .SUFFIXES: .SUFFIXES: .o .c .h .y .l .ps .dvi .info .texi @@ -8,6 +8,7 @@ set when it should not have been (several reports). * FAQ change: mailing lists have moved to MailMan. * Deal with brain-dead netmind mail missing the RFC822 delimiter line. +* ODMR (RFC 2645) support -- untested! fetchmail-5.6.2 (Fri Jan 5 16:45:47 EST 2001), 19744 lines: @@ -11,8 +11,9 @@ fetchmail supports all standard mail-retrieval protocols in use on the Internet: POP2, POP3 (including POP3 with RFC1938 one-time passwords), RPOP, APOP, KPOP, Compuserve's POP3 with RPA, Microsoft's NTLM, Demon Internet's SDPS, all flavors of IMAP (including IMAP4rev1 with RFC1731 -Kerberos v4 or GSSAPI authentication or CRAM-MD5 authentication), and -ESMTP ETRN. Fetchmail also supports end-to-end encryption with OpenSSL. +Kerberos v4 or GSSAPI authentication or CRAM-MD5 authentication), +ESMTP ETRN, and ODMR. Fetchmail also supports end-to-end encryption with +OpenSSL. The fetchmail code was developed under Linux, but has also been extensively tested under the BSD variants, AIX, HP-UX versions 9 and @@ -95,6 +95,9 @@ /* Define if you want ETRN support compiled in */ #undef ETRN_ENABLE +/* Define if you want ODMR support compiled in */ +#undef ODMR_ENABLE + /* Define if you want RPA support compiled in */ #undef RPA_ENABLE @@ -169,6 +169,9 @@ void dump_config(struct runctl *runp, struct query *querylist) #ifdef ETRN_ENABLE printf("'etrn',"); #endif /* ETRN_ENABLE */ +#ifdef ODMR_ENABLE + printf("'odmr',"); +#endif /* ODMR_ENABLE */ #ifdef SSL_ENABLE printf("'ssl',"); #endif /* SSL_ENABLE */ diff --git a/configure.in b/configure.in index 1d8dcdd5..f692fce7 100644 --- a/configure.in +++ b/configure.in @@ -265,6 +265,13 @@ AC_ARG_ENABLE(ETRN, [with_ETRN=yes]) test "$with_ETRN" = "yes" && AC_DEFINE(ETRN_ENABLE) +### use option --disable-ODMR to omit the ODMR support +AC_ARG_ENABLE(ODMR, + [ --disable-ODMR don't compile in ODMR protocol support], + [with_ODMR=$enableval], + [with_ODMR=yes]) +test "$with_ODMR" = "yes" && AC_DEFINE(ODMR_ENABLE) + ### use option --enable-RPA to compile in the RPA support AC_ARG_ENABLE(RPA, [ --enable-RPA compile in RPA protocol support], @@ -215,6 +215,9 @@ const char *showproto(int proto) case P_APOP: return("APOP"); case P_RPOP: return("RPOP"); case P_ETRN: return("ETRN"); +#ifdef ODMR_ENABLE + case P_ODMR: return("ODMR"); +#endif /* ODMR_ENABLE */ default: return("unknown?!?"); } } diff --git a/fetchmail-FAQ.html b/fetchmail-FAQ.html index edc2a455..e0f47e9a 100644 --- a/fetchmail-FAQ.html +++ b/fetchmail-FAQ.html @@ -10,7 +10,7 @@ <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2001/02/07 04:10:02 $ +<td width="30%" align=right>$Date: 2001/02/07 08:01:08 $ </table> <HR> <H1>Frequently Asked Questions About Fetchmail</H1> @@ -357,7 +357,7 @@ The short answer: IMAP4rev1 running over Unix.<P> Here's a longer answer: <P> -Fetchmail will work with any POP, IMAP, or ESMTP/ETRN server that +Fetchmail will work with any POP, IMAP, ETRN, or ODMR server that conforms to the relevant RFCs (and even some outright broken ones like <a href="#S2">Microsoft Exchange</a> and <a href="#S12">Novell GroupWise</a>). This doesn't mean it works equally well with all, @@ -561,6 +561,11 @@ accept mail for your domain but then queue it to forward to your machine. ETRN just tells to server to flush its queue for your domain. Fetchmail doesn't actually get the mail in that case.<p> +You can use On-Demand Mail Relay (ODMR) with a dynamic IP address; +that's what it was designed for, and it provides capabilities very +similar to ETRN. Unfortunately ODMR servers are not yet widely +deployed, as of early 2001.<p> + If you're using a dynamic-IP configuration, one other (non-fetchmail) problem you may run into with outgoing mail is that some sites will bounce your email because the hostname your giving them isn't real @@ -2298,7 +2303,7 @@ server mailbox and then routing based on what's in the To/Cc/Bcc lines.<p> In general, this is not really a good idea. It would be smarter to just let the mail sit in the mailserver's queue and use fetchmail's -ETRN mode to trigger SMTP sends periodically (of course, this means +ETRN or ODMR modes to trigger SMTP sends periodically (of course, this means you have to poll more frequently than the mailserver's expiration period). If you can't arrange this, try setting up a UUCP feed.<P> @@ -2986,7 +2991,7 @@ switching to IMAP and using a short expunge interval.<p> <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2001/02/07 04:10:02 $ +<td width="30%" align=right>$Date: 2001/02/07 08:01:08 $ </table> <P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com"><esr@snark.thyrsus.com></A></ADDRESS> diff --git a/fetchmail-features.html b/fetchmail-features.html index ae49ebef..5f441727 100644 --- a/fetchmail-features.html +++ b/fetchmail-features.html @@ -10,7 +10,7 @@ <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2000/12/06 17:42:20 $ +<td width="30%" align=right>$Date: 2001/02/07 08:01:08 $ </table> <HR> @@ -18,6 +18,8 @@ <H2>Since 5.0:</H2> <UL> +<LI>Support for On-Demand Mail Relay, RFC 2645.<p> + <LI>It's now easy to deliver mail to a local LMTP socket.<p> <LI>The interface option now checks both local and remote interface IPs.<p> @@ -236,7 +238,7 @@ get-mail, gwpop, pimp-1.0, pop-perl5-1.2, popc, popmail-1.6 and upop.<P> <table width="100%" cellpadding=0><tr> <td width="30%">Back to <a href="index.html">Fetchmail Home Page</a> <td width="30%" align=center>To <a href="/~esr/sitemap.html">Site Map</a> -<td width="30%" align=right>$Date: 2000/12/06 17:42:20 $ +<td width="30%" align=right>$Date: 2001/02/07 08:01:08 $ </table> <P><ADDRESS>Eric S. Raymond <A HREF="mailto:esr@thyrsus.com"><esr@snark.thyrsus.com></A></ADDRESS> diff --git a/fetchmail.c b/fetchmail.c index ee46cdeb..1394b567 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -230,6 +230,9 @@ int main(int argc, char **argv) #ifndef ETRN_ENABLE printf("-ETRN"); #endif /* ETRN_ENABLE */ +#ifndef ODMR_ENABLE + printf("-ODMR"); +#endif /* ODMR_ENABLE */ #ifdef SSL_ENABLE printf("+SSL"); #endif @@ -496,7 +499,7 @@ int main(int argc, char **argv) for (ctl = querylist; ctl; ctl = ctl->next) { if (ctl->active && !(implicitmode && ctl->server.skip) - && ctl->server.protocol != P_ETRN + && ctl->server.protocol != P_ETRN && ctl->server.protocol != P_IMAP_K4 #ifdef GSSAPI && ctl->server.protocol != P_IMAP_GSS @@ -1091,15 +1094,17 @@ static int load_params(int argc, char **argv, int optind) * do this unconditionally, but it made fetchmail excessively * vulnerable to misconfigured DNS setups. * - * If we're using ETRN, the smtp hunt list is the list of - * systems we're polling on behalf of; these have to be - * fully-qualified domain names. The default for this list - * should be the FQDN of localhost. + * If we're using ETRN or ODMR, the smtp hunt list is the + * list of systems we're polling on behalf of; these have + * to be fully-qualified domain names. The default for + * this list should be the FQDN of localhost. * * If we're using Kerberos for authentication, we need - * the FQDN in order to generate capability keys. - */ + * the FQDN in order to generate capability keys. */ if (ctl->server.protocol == P_ETRN +#ifdef ODMR_ENABLE + || ctl->server.protocol == P_ODMR +#endif /* ODMR_ENABLE */ || ctl->server.preauthenticate == A_KERBEROS_V4 || ctl->server.preauthenticate == A_KERBEROS_V5) if (strcmp(fetchmailhost, "localhost") == 0) @@ -1494,6 +1499,18 @@ static int query_host(struct query *ctl) return(PS_PROTOCOL); #endif /* HAVE_GETHOSTBYNAME */ #endif /* ETRN_ENABLE */ + case P_ODMR: +#ifndef ODMR_ENABLE + report(stderr, _("ODMR support is not configured.\n")); + return(PS_PROTOCOL); +#else +#ifdef HAVE_GETHOSTBYNAME + return(doODMR(ctl)); +#else + report(stderr, _("Cannot support ODMR without gethostbyname(2).\n")); + return(PS_PROTOCOL); +#endif /* HAVE_GETHOSTBYNAME */ +#endif /* ODMR_ENABLE */ default: report(stderr, _("unsupported protocol selected.\n")); return(PS_PROTOCOL); @@ -1537,7 +1554,7 @@ static void dump_params (struct runctl *runp, printf(_("Options for retrieving from %s@%s:\n"), ctl->remotename, visbuf(ctl->server.pollname)); - if (ctl->server.via && (ctl->server.protocol != P_ETRN)) + if (ctl->server.via && (ctl->server.protocol < P_ETRN)) printf(_(" Mail will be retrieved via %s\n"), ctl->server.via); if (ctl->server.interval) @@ -1597,7 +1614,7 @@ static void dump_params (struct runctl *runp, #endif /* INET6_ENABLE */ else if (outlevel >= O_VERBOSE) printf(_(" (using default port)")); - if (ctl->server.uidl && (ctl->server.protocol != P_ETRN)) + if (ctl->server.uidl && (ctl->server.protocol < P_ETRN)) printf(_(" (forcing UIDL use)")); putchar('.'); putchar('\n'); @@ -1621,7 +1638,7 @@ static void dump_params (struct runctl *runp, else printf(".\n"); - if (ctl->server.protocol != P_ETRN) { + if (ctl->server.protocol < P_ETRN) { if (!ctl->mailboxes->id) printf(_(" Default mailbox selected.\n")); else @@ -1688,7 +1705,7 @@ static void dump_params (struct runctl *runp, printf(_(" SMTP message batch limit is %d.\n"), ctl->batchlimit); else if (outlevel >= O_VERBOSE) printf(_(" No SMTP message batch limit (--batchlimit 0).\n")); - if (ctl->server.protocol != P_ETRN) + if (ctl->server.protocol < P_ETRN) { if (NUM_NONZERO(ctl->expunge)) printf(_(" Deletion interval between expunges forced to %d (--expunge %d).\n"), ctl->expunge, ctl->expunge); @@ -1698,7 +1715,7 @@ static void dump_params (struct runctl *runp, } if (ctl->bsmtp) printf(_(" Messages will be appended to %s as BSMTP\n"), visbuf(ctl->bsmtp)); - else if (ctl->mda && (ctl->server.protocol != P_ETRN)) + else if (ctl->mda && (ctl->server.protocol < P_ETRN)) printf(_(" Messages will be delivered with \"%s\".\n"), visbuf(ctl->mda)); else { @@ -1719,7 +1736,7 @@ static void dump_params (struct runctl *runp, printf(_(" Address to be put in RCPT TO lines shipped to SMTP will be %s\n"), ctl->smtpname); } - if (ctl->server.protocol != P_ETRN) + if (ctl->server.protocol < P_ETRN) { if (ctl->antispam != (struct idlist *)NULL) { @@ -1743,7 +1760,7 @@ static void dump_params (struct runctl *runp, visbuf(ctl->postconnect)); else if (outlevel >= O_VERBOSE) printf(_(" No post-connection command.\n")); - if (ctl->server.protocol != P_ETRN) { + if (ctl->server.protocol < P_ETRN) { if (!ctl->localnames) printf(_(" No localnames declared for this host.\n")); else @@ -1840,7 +1857,7 @@ static void dump_params (struct runctl *runp, else if (outlevel >= O_VERBOSE) printf(_(" No plugout command specified.\n")); - if (ctl->server.protocol > P_POP2 && (ctl->server.protocol != P_ETRN)) + if (ctl->server.protocol > P_POP2 && (ctl->server.protocol < P_ETRN)) { if (!ctl->oldsaved) printf(_(" No UIDs saved from this host.\n")); diff --git a/fetchmail.h b/fetchmail.h index b70bd48e..ef6d4677 100644 --- a/fetchmail.h +++ b/fetchmail.h @@ -17,6 +17,7 @@ #define P_IMAP_CRAM_MD5 9 #define P_IMAP_LOGIN 10 #define P_ETRN 11 +#define P_ODMR 12 #if INET6_ENABLE #define SMTP_PORT "smtp" @@ -531,6 +532,7 @@ int is_host_alias(const char *, struct query *); char *host_fqdn(void); char *rfc822timestamp(void); flag isafile(int); +int do_cram_md5 (int sock, struct query *ctl); void yyerror(const char *); int yylex(void); diff --git a/fetchmail.man b/fetchmail.man index dda850df..737b92f9 100644 --- a/fetchmail.man +++ b/fetchmail.man @@ -26,7 +26,7 @@ The .I fetchmail program can gather mail from servers supporting any of the common mail-retrieval protocols: POP2, POP3, IMAP2bis, IMAP4, and IMAPrev1. -It can also use the ESMTP ETRN extension. (The RFCs describing all +It can also use the ESMTP ETRN extension and ODMR. (The RFCs describing all these protocols are listed at the end of this manual page.) .PP While @@ -109,7 +109,7 @@ Return a status code to indicate whether there is mail waiting, without actually fetching or deleting mail (see EXIT CODES below). This option turns off daemon mode (in which it would be useless). It doesn't play well with queries to multiple sites, and doesn't work -with ETRN. It will return a false positive if you leave read but +with ETRN or ODMR. It will return a false positive if you leave read but undeleted mail in your server mailbox and your fetch protocol can't tell kept messages from new ones. This means it will work with IMAP, not work with POP2, and may occasionally flake out under POP3. @@ -133,7 +133,8 @@ Retrieve both old (seen) and new messages from the mailserver. The default is to fetch only messages the server has not marked seen. Under POP3, this option also forces the use of RETR rather than TOP. Note that POP2 retrieval behaves as though --all is always on (see -RETRIEVAL FAILURE MODES below) and this option does not work with ETRN. +RETRIEVAL FAILURE MODES below) and this option does not work with ETRN +or ODMR. .TP .B \-k, --keep (Keyword: keep) @@ -142,18 +143,19 @@ 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. This option does not work with ETRN. +mailserver. This option does not work with ETRN or ODMR. .TP .B \-K, --nokeep (Keyword: nokeep) 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 \fBkeep\fR in your -\&\fI.fetchmailrc\fR. This option is forced on with ETRN. +\&\fI.fetchmailrc\fR. This option is forced on with ETRN and ODMR. .TP .B \-F, --flush POP3/IMAP only. Delete old (previously retrieved) messages from the mailserver -before retrieving new messages. This option does not work with ETRN. +before retrieving new messages. This option does not work with ETRN or +ODMR. Warning: if your local MTA hangs and fetchmail is aborted, the next time you run fetchmail, it will delete mail that was never delivered to you. What you probably want is the default setting: if you don't specify `-k', then @@ -199,15 +201,20 @@ with plain LOGIN authentication only, even if the server supports better methods. .IP ETRN Use the ESMTP ETRN option. +.IP ODMR +Use the the On-Demand Mail Relay ESMTP profile. .RE .P All these alternatives work in basically the same way (communicating with standard server daemons to fetch mail already delivered to a -mailbox on the server) except ETRN. The ETRN mode allows you to ask a -compliant ESMTP server (such as BSD sendmail at release 8.8.0 or -higher) to immediately open a sender-SMTP connection to your -client machine and begin forwarding any items addressed to your client -machine in the server's queue of undelivered mail. +mailbox on the server) except ETRN and ODMR. The ETRN mode +allows you to ask a compliant ESMTP server (such as BSD sendmail at +release 8.8.0 or higher) to immediately open a sender-SMTP connection +to your client machine and begin forwarding any items addressed to +your client machine in the server's queue of undelivered mail. The +ODMR mode requires an ODMR-capable server and works similarly to +ETRN, except that it does not require the client machine to have +a static DNS. .TP .B \-U, --uidl (Keyword: uidl) @@ -263,7 +270,7 @@ from plugin). Causes a specified non-default mail folder on the mailserver (or comma-separated list of folders) to be retrieved. The syntax of the folder name is server-dependent. This option is not available under -POP3 or ETRN. +POP3, ETRN, or ODMR. .TP .B \--ssl (Keyword: ssl) @@ -309,7 +316,7 @@ server. This can cause some complications in daemon mode. Specify a hunt list of hosts to forward mail to (one or more hostnames, comma-separated). In ETRN mode, set the host that the mailserver is asked to ship mail to. Hosts are tried in list order; -the first one that is up becomes the forwarding or ETRN target for the +the first one that is up becomes the forwarding target for the current run. Normally, `localhost' is added to the end of the list as an invisible default. However, when using ETRN mode or Kerberos preauthentication, the FQDN of the machine running fetchmail is added to @@ -322,6 +329,8 @@ interpreted as the name of a UNIX socket accepting LMTP connections --smtphost server1,server2/2525,server3,/var/imap/socket/lmtp +In ODMR mode, this option specifies the list of domains the ODMR +server should ship mail for once the connection is turned around. .TP .B \-D <domain>, --smtpaddress <domain> (Keyword: smtpaddress) @@ -388,7 +397,7 @@ explicit --limit of 0 overrides any limits set in your run control file. This option is intended for those needing to strictly control fetch time due to expensive and variable phone rates. In daemon mode, oversize notifications are mailed to the calling user (see the ---warnings option). This option does not work with ETRN. +--warnings option). This option does not work with ETRN or ODMR. .TP .B \-w <interval>, --warnings <interval> (Keyword: warnings) @@ -414,14 +423,14 @@ prompt. MTAs like \fIqmail\fR(8) and \fIsmail\fR(8) may wait till the delivery socket is shut down to deliver. This may produce annoying delays when \fIfetchmail\fR is processing very large batches. Setting the batch limit to some nonzero size will prevent these delays. This -option does not work with ETRN. +option does not work with ETRN or ODMR. .TP .B -B <number>, --fetchlimit <number> (Keyword: fetchlimit) Limit the number of messages accepted from a given server in a single poll. By default there is no limit. An explicit --fetchlimit of 0 overrides any limits set in your run control file. -This option does not work with ETRN. +This option does not work with ETRN or ODMR. .TP .B -e <count>, --expunge <count> (keyword: expunge) @@ -444,7 +453,7 @@ it tells .I fetchmail to only issue expunges on every Nth delete. An argument of zero suppresses expunges entirely (so no expunges at all will be done until -the end of run). This option does not work with ETRN. +the end of run). This option does not work with ETRN or ODMR. .SS Authentication Options .TP .B \-u <name>, --username <name> @@ -514,7 +523,7 @@ choosing KPOP protocol automatically selects Kerberos preauthentication, and all other alternatives use password authentication (though APOP uses a generated one-time key as the password and IMAP-K4 uses RFC1731 Kerberos v4 authentication). This -option does not work with ETRN. +option does not work with ETRN or ODMR. .SS Miscellaneous Options .TP .B \-f <pathname>, --fetchmailrc <pathname> @@ -544,7 +553,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. +When using ETRN or ODMR, the rewrite option is ineffective. .TP .B -E <line>, --envelope <line> (Keyword: envelope) @@ -969,7 +978,7 @@ 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; +In ETRN and ODMR modes, \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. @@ -1752,7 +1761,7 @@ poll mailhost.net with proto imap and preauth ssh: .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. +All multidrop features are ineffective in ETRN and ODMR modes. Also, note that in multidrop mode duplicate mails are suppressed. A piece of mail is considered duplicate if it has the same message-ID as @@ -1856,10 +1865,10 @@ If you're tempted to use to retrieve mail for multiple users from a single mail drop via POP or IMAP, think again (and reread the section on header and envelope addresses above). It would be smarter to just let the mail sit in the -mailserver's queue and use fetchmail's ETRN mode to trigger SMTP sends -periodically (of course, this means you have to poll more frequently -than the mailserver's expiry period). If you can't arrange this, try -setting up a UUCP feed. +mailserver's queue and use fetchmail's ETRN or ODMR modes to trigger +SMTP sends periodically (of course, this means you have to poll more +frequently than the mailserver's expiry period). If you can't arrange +this, try setting up a UUCP feed. .PP If you absolutely \fImust\fR use multidrop for this purpose, make sure your mailserver writes an envelope-address header that fetchmail can @@ -1867,7 +1876,7 @@ see. Otherwise you \fIwill\fR lose mail and it \fIwill\fR come back to haunt you. .SS Speeding Up Multidrop Checking -Normally, when multiple user are declared +Normally, when multiple users are declared .I fetchmail extracts recipient addresses as described above and checks each host part with DNS to see if it's an alias of the mailserver. If so, the @@ -2071,6 +2080,8 @@ The UIDL code is generally flaky and tends to lose its state on errors and line drops (so that old messages are re-seen). If this happens to you, switch to IMAP4. .PP +The ODMR code is untested. +.PP The `principal' option only handles Kerberos IV, not V. .PP Send comments, bug reports, gripes, and the like to the @@ -2111,6 +2122,9 @@ RFC 2683 ETRN: RFC 1985 .TP 5 +ODMR: +2645 +.TP 5 OTP: RFC 1938 .TP 5 diff --git a/fetchmailconf b/fetchmailconf index e3719057..773a7698 100755 --- a/fetchmailconf +++ b/fetchmailconf @@ -4,7 +4,7 @@ # by Eric S. Raymond, <esr@snark.thyrsus.com>. # Requires Python with Tkinter, and the following OS-dependent services: # posix, posixpath, socket -version = "1.34" +version = "1.35" from Tkinter import * from Dialog import * @@ -372,7 +372,8 @@ defaultports = {"auto":0, "IMAP":143, "IMAP-GSS":143, "IMAP-K4":143, - "ETRN":25} + "ETRN":25, + "ODMR":366} preauthlist = ("password", "kerberos", "ssh") @@ -408,17 +409,22 @@ class LabeledEntry(Frame): def ButtonBar(frame, legend, ref, alternatives, depth, command): # array of radio buttons, caption to left, picking from a string list bar = Frame(frame) - width = len(alternatives) / depth; + width = (len(alternatives)+1) / depth; Label(bar, text=legend).pack(side=LEFT) for column in range(width): subframe = Frame(bar) for row in range(depth): ind = width * row + column - Radiobutton(subframe, + if ind < len(alternatives): + Radiobutton(subframe, {'text':alternatives[ind], 'variable':ref, 'value':alternatives[ind], 'command':command}).pack(side=TOP, anchor=W) + else: + # This is just a spacer + Radiobutton(subframe, + {'text':" ",'state':DISABLED}).pack(side=TOP, anchor=W) subframe.pack(side=LEFT) bar.pack(side=TOP); return bar @@ -1046,6 +1052,8 @@ class ServerEdit(Frame, MyWidget): protolist.append("IMAP-K4") if 'etrn' in feature_options: protolist.append("ETRN") + if 'odmr' in feature_options: + protolist.append("ODMR") protwin = Frame(leftwin, relief=RAISED, bd=5) Label(protwin, text="Protocol").pack(side=TOP) @@ -1579,7 +1587,7 @@ class UserEdit(Frame, MyWidget): self.fetchlimit, '30').pack(side=TOP, fill=X) LabeledEntry(limwin, 'Max messages to forward per poll:', self.batchlimit, '30').pack(side=TOP, fill=X) - if self.parent.server.protocol != 'ETRN': + if self.parent.server.protocol not in ('ETRN', 'ODMR'): LabeledEntry(limwin, 'Interval between expunges:', self.expunge, '30').pack(side=TOP, fill=X) Checkbutton(limwin, text="Idle after each poll (IMAP only)", @@ -30,7 +30,6 @@ #include <krb.h> #endif #endif /* KERBEROS_V4 */ -#include "i18n.h" #ifdef GSSAPI #ifdef HAVE_GSSAPI_H @@ -47,7 +46,7 @@ #endif #endif -#include "md5.h" +#include "i18n.h" #if OPIE_ENABLE #include <opie.h> @@ -633,49 +632,6 @@ static int do_gssauth(int sock, char *hostname, char *username) } #endif /* GSSAPI */ -static void hmac_md5 (unsigned char *password, size_t pass_len, - unsigned char *challenge, size_t chal_len, - unsigned char *response, size_t resp_len) -{ - int i; - unsigned char ipad[64]; - unsigned char opad[64]; - unsigned char hash_passwd[16]; - - MD5_CTX ctx; - - if (resp_len != 16) - return; - - if (pass_len > sizeof (ipad)) - { - MD5Init (&ctx); - MD5Update (&ctx, password, pass_len); - MD5Final (hash_passwd, &ctx); - password = hash_passwd; pass_len = sizeof (hash_passwd); - } - - memset (ipad, 0, sizeof (ipad)); - memset (opad, 0, sizeof (opad)); - memcpy (ipad, password, pass_len); - memcpy (opad, password, pass_len); - - for (i=0; i<64; i++) { - ipad[i] ^= 0x36; - opad[i] ^= 0x5c; - } - - MD5Init (&ctx); - MD5Update (&ctx, ipad, sizeof (ipad)); - MD5Update (&ctx, challenge, chal_len); - MD5Final (response, &ctx); - - MD5Init (&ctx); - MD5Update (&ctx, opad, sizeof (opad)); - MD5Update (&ctx, response, resp_len); - MD5Final (response, &ctx); -} - #if NTLM_ENABLE #include "ntlm.h" @@ -754,89 +710,6 @@ static int do_imap_ntlm(int sock, struct query *ctl) } #endif /* NTLM */ -static int do_cram_md5 (int sock, struct query *ctl) -/* authenticate as per RFC2195 */ -{ - int result; - int len; - unsigned char buf1[1024]; - unsigned char msg_id[768]; - unsigned char response[16]; - unsigned char reply[1024]; - - gen_send (sock, "AUTHENTICATE CRAM-MD5"); - - /* From RFC2195: - * The data encoded in the first ready response contains an - * presumptively arbitrary string of random digits, a timestamp, and the - * fully-qualified primary host name of the server. The syntax of the - * unencoded form must correspond to that of an RFC 822 'msg-id' - * [RFC822] as described in [POP3]. - */ - - if ((result = gen_recv (sock, buf1, sizeof (buf1)))) { - return result; - } - - len = from64tobits (msg_id, buf1); - if (len < 0) { - report (stderr, _("could not decode BASE64 challenge\n")); - return PS_AUTHFAIL; - } else if (len < sizeof (msg_id)) { - msg_id[len] = 0; - } else { - msg_id[sizeof (msg_id)-1] = 0; - } - if (outlevel >= O_DEBUG) { - report (stdout, _("decoded as %s\n"), msg_id); - } - - /* The client makes note of the data and then responds with a string - * consisting of the user name, a space, and a 'digest'. The latter is - * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where - * the key is a shared secret and the digested text is the timestamp - * (including angle-brackets). - */ - - hmac_md5 (ctl->password, strlen (ctl->password), - msg_id, strlen (msg_id), - response, sizeof (response)); - -#ifdef HAVE_SNPRINTF - snprintf (reply, sizeof (reply), -#else - sprintf(reply, -#endif - "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", - ctl->remotename, - response[0], response[1], response[2], response[3], - response[4], response[5], response[6], response[7], - response[8], response[9], response[10], response[11], - response[12], response[13], response[14], response[15]); - - if (outlevel >= O_DEBUG) { - report (stdout, _("replying with %s\n"), reply); - } - - to64frombits (buf1, reply, strlen (reply)); - if (outlevel >= O_MONITOR) { - report (stdout, "IMAP> %s\n", buf1); - } - - /* PMDF5.2 IMAP has a bug that requires this to be a single write */ - strcat (buf1, "\r\n"); - SockWrite (sock, buf1, strlen (buf1)); - - if ((result = gen_recv (sock, buf1, sizeof (buf1)))) - return result; - - if (strstr (buf1, "OK")) { - return PS_SUCCESS; - } else { - return PS_AUTHFAIL; - } -} - int imap_canonicalize(char *result, char *raw, int maxlen) /* encode an IMAP password as per RFC1730's quoting conventions */ { @@ -181,6 +181,7 @@ options {/* EMPTY */} (imap)|(IMAP) { yylval.proto = P_IMAP; return PROTO; } (apop)|(APOP) { yylval.proto = P_APOP; return PROTO; } (etrn)|(ETRN) { yylval.proto = P_ETRN; return PROTO; } +(odmr)|(ODMR) { yylval.proto = P_ODMR; return PROTO; } (kpop)|(KPOP) { return KPOP; } (#.*)?\\?\n { prc_lineno++; } /* newline is ignored */ @@ -27,6 +27,9 @@ static struct opt extensions[] = {"8BITMIME", ESMTP_8BITMIME}, {"SIZE", ESMTP_SIZE}, {"ETRN", ESMTP_ETRN}, +#ifdef ODMR_ENABLE + {"ATRN", ESMTP_ATRN}, +#endif /* ODMR_ENABLE */ {(char *)NULL, 0}, }; @@ -18,6 +18,7 @@ #define ESMTP_8BITMIME 0x01 #define ESMTP_SIZE 0x02 #define ESMTP_ETRN 0x04 +#define ESMTP_ATRN 0x08 /* used with ODMR, RFC 2645 */ void SMTP_setmode(char); int SMTP_helo(int socket,const char *host); |