]> Pileus Git - ~andy/fetchmail/commitdiff
Merge branch 'legacy_63'
authorMatthias Andree <matthias.andree@gmx.de>
Sat, 11 May 2013 11:23:01 +0000 (13:23 +0200)
committerMatthias Andree <matthias.andree@gmx.de>
Sat, 11 May 2013 11:23:01 +0000 (13:23 +0200)
1  2 
NEWS
fetchmail-FAQ.html
fetchmail.h

diff --combined NEWS
index 3942d4333d758845aa98710887d38ecc6eb64a78,24011bf0add0f7ee9e05b2f918294ff18df4f3d3..f44f15e7454b7c82ee1f2b951a5c39425a67f89a
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
@@@ -10,11 -10,18 +10,11 @@@ change.  MA = Matthias Andree, ESR = Er
  
  # ADVANCE WARNING OF FEATURES TO BE REMOVED OR CHANGED IN FUTURE VERSIONS
  (There are no plans to remove features from a 6.3.X release, but they may be
 -removed from a 6.4.0 or newer release.)
 -* The MX and host alias DNS lookups that fetchmail performs in multidrop mode
 -  are based on assumptions that are rarely met in practice, somewhat defective,
 -  deprecated and may be removed from a future fetchmail version.
 -  They have never supported IPv6 (including IPv6-mapped IPv4).
 -  Non-DNS based alias keywords such as "aka" will remain in fetchmail.
 +removed from a 7.0.0 or newer release.)
  * The monitor and interface options may be removed from a future fetchmail
    version as they are not reasonably portable across operating systems.
 -* POP2 is obsolete, support will be removed from a future fetchmail version.
 -* IMAP2 and IMAP4 (not IMAP4r1) are obsolete, support may be removed from a
 +* IMAP4 (not IMAP4r1) is obsolete, support may be removed from a
    future fetchmail version.
 -* RPOP is obsolete, support will be removed from a future fetchmail release.
  * --sslcertck will become a default setting in a future fetchmail version.
  * The multidrop To/Cc guessing code along with the fragile duplicate suppressor
    is deprecated and may be removed from a future release.
    inconsistent and confusing.
  * The "protocol auto" default inside fetchmail may be removed from a future
    fetchmail release. Explicit configuration of the protocol is recommended.
 -* Kerberos IV support may be removed from a future fetchmail release.
  * Kerberos 5 support may be removed from a future fetchmail release.
 -* The --principal option may be removed from a future fetchmail release.
  * SIGHUP wakeup support may be removed from a future fetchmail release and
    cause fetchmail to terminate - it was broken for many years.
 -* Support for operating systems that are not sufficiently POSIX compliant may be
 -  removed or operation on such systems may be suboptimal for future releases.
 -  This means that fetchmail may only continue to work on C99 and POSIX 2001
 -  based systems.
  * The maintainer may migrate fetchmail to C++ with STL or C#, and impose further
    requirements (dependencies), such as Boost or other class libraries.
 -* The softbounce option default will change to "false" in the next release.
  * The --bsmtp - mode of operation may be removed in a future release.
  * Given that OpenSSL is severely underdocumented, and needs license exceptions,
    fetchmail may switch to a different SSL library.
 -* SSLv2 support will be removed from a future fetchmail release. It has been
 -  obsolete for more than a decade.
 +--------------------------------------------------------------------------------
 +
 +fetchmail-7.0.0 (not yet released):
 +
 +NOTE THIS IS AN ALPHA RELEASE THAT HAS NOT BEEN THOROUGHLY TESTED!
 +
 +# MAJOR CHANGES
 +* The UIDL handler code is now much faster, especially noticable with lots of
 +  mail kept on a POP3 server. Where the 6.3.X code was of O(n^2) complexity,
 +  we're down to O(n log n).
 +  Contributed by Rainer Weikusat, MAD Partners Ltd./MSS GmbH.
 +* The POP3 code now always uses UIDL, except if "fetchall" is in effect.
 +  Fixes BerliOS Bug #16172. Fixes Debian Bug#345788.
 +* Fetchmail now enables SSL support by default. If this is undesired,
 +  ./configure --without-ssl should help.
 +* The OpenSSL code now excludes the SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS option.
 +  This can cause interoperability problems with certain buggy servers, but is
 +  required to defang chosen-plaintext attacks against AES.  While probably hard
 +  to mount against fetchmail, let's play it safe rather than be sorry later.
 +
 +# FEATURES ADDED
 +* Fetchmail can now retrieve credentials from PWMD. This needs to be enabled at
 +  compile-time and requires run-time configuration. See README.PWMD for details.
 +  Contributed by Ben Kibbey, author of libpwmd and pwmd.
 +* Fetchmail now supports a retrieve-error command line or rcfile option that
 +  takes exactly one argument, abort (default), continue or markseen.  This
 +  specifies the policy used by fetchmail to handle messages whose bodies
 +  fail to be retrieved due to server errors.  Both the continue and markseen
 +  options will skip the message with errors and allow the session to
 +  continue so that subsequent messages can be retrieved.  The markseen
 +  option will also mark the message with errors as seen.
 +  The default policy is to abort the session whenever a server error occurs.
 +  Contributed by Craig Brown.
 +* Fetchmailconf offers cram-md5 and apop authentication.
 +
 +# REMOVED FEATURES
 +* IMAP2 protocol support was removed.
 +* POP2 protocol support was removed.
 +* RPOP (not actually a protocol, but a variant of POP3) was removed
 +* POP3: the uidl option has been removed. It is always on.
 +* POP3: LAST is no longer used. It was removed from POP3 in 1994, and it could
 +  cause mail loss when the connection was interrupted or if clients besides
 +  fetchmail polled the mailbox.
 +* Trio was removed, fetchmail expects reasonable stdio.h quality levels.
 +* Support for systems that do not conform to C89 and POSIX 2001 was removed,
 +  this means that BeOS, EMX, NeXTSTEP quirks are no longer worked around.
 +* The MX and host alias DNS lookups that fetchmail performs in multidrop mode
 +  have been removed. They were based on the mistaken assumption that the
 +  IMAP/POP3 server was also the MX server, which is rarely the case.  They have
 +  never supported IPv6 (including IPv6-mapped IPv4) either.
 +  Non-DNS based alias keywords such as "aka" remain.
 +* Kerberos IV support was removed.
 +* fetchmail no longer supports SSL v2, nor the corresponding SSL2 option to
 +  --sslproto. SSLv2 is insecure and had been deprecated 15 years ago. fetchmail
 +  will actively forbid SSLv2 negotiation by means of SSL_OP_NO_SSLv2.
 +  To fix Debian Bug#622054.
 +* A lot of outdated and/or unsafe-to-use material got dropped from contrib/.
 +
 +# REGRESSION FIXES
 +* The mimedecode feature now properly detects multipart/mixed-type matches, so
 +  that quoted-printable-encoded multipart messages can get decoded.
 +  (Regression in 5.0.0 on 1999-03-27, as a side effect of a PGP-mimedecode fix
 +  attributed to Henrik Storner.)
 +
 +# BUG FIXES
 +* The mimedecode feature failed to ship the last line of the body if it was
 +  encoded as quoted-printable and had a MIME soft line break in the very last
 +  line.  Reported by Lars Hecking in June 2011.
 +  Bug introduced on 1998-03-20 when the mimedecode support was added by ESR
 +  before release 4.4.1 through code contributed by Henrik Storner.
 +  Workaround for older releases: do not use mimedecode feature.
 +* Fetchmail now detects singly-quoted % expansions in the mda option and refuses
 +  to deliver for safety reasons. Fixes Debian Bug#347909.
 +* The Server certificate: message in verbose mode now appears on stdout like the
 +  remainder of the output. Reported by Henry Jensen, to fix Debian Bug #639807.
 +
 +# CHANGES
 +* A foreground fetchmail can now accept a few more options while another copy is
 +  running in the background.
 +* APOP is no longer a protocol, but an authentication method. In order to use
 +  it, use protocol POP3 auth APOP, or on the commandline, -p pop3 --auth apop.
 +  If no authentication method is specified, APOP is automatically tried if
 +  offered by the server before we resort to sending the password as clear text.
 +
 +# KNOWN BUGS AND WORKAROUNDS
 +  (This section floats upwards through the NEWS file so it stays with the
 +  current release information)
 +* Fetchmail does not handle messages without Message-ID header well
 +  (See sourceforge.net bug #780933)
 +* BSMTP is mostly untested and errors can cause corrupt output.
 +* Sun Workshop 6 (SPARC) is known to miscompile the configuration file lexer in
 +  64-bit mode.  Either compile 32-bit code or use GCC to compile 64-bit
 +  fetchmail.  Note that fetchmail doesn't take advantage of 64-bit code,
 +  so compiling 32-bit SPARC code should not cause any difficulties.
 +* Fetchmail does not track pending deletes across crashes.
 +* The command line interface is sometimes a bit stubborn, for instance,
 +  fetchmail -s doesn't work with a daemon running.
 +* Linux systems may return duplicates of an IP address in some circumstances if
 +  no or no global IPv6 addresses are configured.
 +  (No workaround. Ubuntu Bug#582585, Novell Bug#606980.)
 +* Kerberos 5 may be broken, particularly on Heimdal, and provide bogus error
 +  messages. This will not be fixed, because the maintainer has no Kerberos 5
 +  server to test against. Use GSSAPI.
  
  --------------------------------------------------------------------------------
  
+ fetchmail-6.3.27 (not yet released, if ever):
+ # FIXES
+ * Fix a typo in the FAQ. Submitted by David Lawyer, Debian Bug#706776.
  fetchmail-6.3.26 (released 2013-04-23, 26180 LoC):
  
  # NOTE THAT FETCHMAIL IS NO LONGER PUBLISHED THROUGH IBIBLIO.
@@@ -296,16 -215,16 +302,16 @@@ fetchmail-6.3.22 (released 2012-08-29, 
    Reported by J. Porter Clark.
  
  * for CVE-2011-3389:
 -  SSL/TLS (wrapped and STARTTLS): fetchmail used to disable a countermeasure 
 -  against a certain kind of attack against cipher block chaining initialization 
 +  SSL/TLS (wrapped and STARTTLS): fetchmail used to disable a countermeasure
 +  against a certain kind of attack against cipher block chaining initialization
    vectors (SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS).
 -  Whether this creates an exploitable situation, depends on the server and the 
 +  Whether this creates an exploitable situation, depends on the server and the
    negotiated ciphers.
 -  As a precaution, fetchmail 6.3.22 enables the countermeasure, by clearing 
 +  As a precaution, fetchmail 6.3.22 enables the countermeasure, by clearing
    SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS.
  
 -  NOTE that this can cause connections to certain non-conforming servers to 
 -  fail, in which case you can set the environment variable 
 +  NOTE that this can cause connections to certain non-conforming servers to
 +  fail, in which case you can set the environment variable
    FETCHMAIL_DISABLE_CBC_IV_COUNTERMEASURE to any non-empty value when starting
    fetchmail to re-instate the compatibility option at the expense of security.
  
  # CHANGES
  * On systems where SSLv2_client_method isn't defined in OpenSSL (such as
    newer Debian, and Ubuntu starting with 11.10 oneiric ocelot), don't
 -  reference it (to fix the build) and if configured, print a run-time error 
 -  that the OS does not support SSLv2. Fixes Debian Bug #622054, 
 +  reference it (to fix the build) and if configured, print a run-time error
 +  that the OS does not support SSLv2. Fixes Debian Bug #622054,
    but note that that bug report has a more thorough patch that does away with
    SSLv2 altogether.
  
  * [vi]    Vietnamese, by Trần Ngọc Quân
  
  
 +
  fetchmail-6.3.21 (released 2011-08-21, 26011 LoC):
  
  # CRITICAL BUG FIX
@@@ -823,8 -741,8 +829,8 @@@ fetchmail 6.3.10 (released 2009-07-02)
    termination signal properly through sys/wait.h macros.
  * When acquiring a body, understand NIL ("no such data item"), as returned by
    some MS Exchange versions. Fixes BerliOS Bug #11980 by KB Sriram.
 -* Make progress tickers (-v/--showdots) consistent, and update documentation 
 -  accordingly ("." for each 1024 octets read, "#" for a header written, and "*" 
 +* Make progress tickers (-v/--showdots) consistent, and update documentation
 +  accordingly ("." for each 1024 octets read, "#" for a header written, and "*"
    for each body line written.)
    The conditions under which these had been printed were inconsistent,
    illogical, and documentation hadn't matched real behaviour for long.
@@@ -917,7 -835,7 +923,7 @@@ fetchmail 6.3.9 (released 2008-11-16)
    random memory location (it calls va_arg() too often without
    resetting it with va_start()). Based on a patch (BerliOS patch #2492)
    by Petr Uzel, fixes Novell Bug #354291.
 -  Note 6.3.9-rc1 did not completely fix this issue, so it was redrawn a few 
 +  Note 6.3.9-rc1 did not completely fix this issue, so it was redrawn a few
    hours after its release.
    See also fetchmail-SA-2008-01.txt.
  * When expunging, mark the right messages as seen to avoid message loss in "keep
  # CHANGES:
  * autoconf 2.60 is now required to build fetchmail; it uses
    AC_USE_SYSTEM_EXTENSIONS to replace AC_AIX, AC_MINIX, and the like.
 -* Removed dead FETCHMAIL_DEBUG code from fetchmail.h that was disabled by 
 -  default with no switches in configure to enable it. However, the macro would 
 +* Removed dead FETCHMAIL_DEBUG code from fetchmail.h that was disabled by
 +  default with no switches in configure to enable it. However, the macro would
    have been prone to a symlink attack. Found by Nico Golde.
  * Removed dead FORCE_STUFFING code from socket.c that was disabled by default
    with no switches in configure to enable it.
  
  # DOCUMENTATION:
  * Add fetchmail-SA-2007-02.txt and fetchmail-SA-2008-01.txt.
 -* Re-add two lines to the manual page that had accidentally become comments 
 -  to nroff. One was part of the --sslproto documentation, and one in the 
 +* Re-add two lines to the manual page that had accidentally become comments
 +  to nroff. One was part of the --sslproto documentation, and one in the
    "Awakening the background daemon" section.
 -* The manual page no longer asserts that .fetchids were for exclusive POP3 use, 
 +* The manual page no longer asserts that .fetchids were for exclusive POP3 use,
    since it is planned to use the file with IMAP4 later.
  * Add grammar fixes from Dan Jacobson to fetchmail.man. Debian Bug #461642.
  * The manual page now mentions that user descriptions need to come before user
    silently accept additional g=x permissions for compatibility with previous
    6.2.X and 6.3.X versions.
    Inconsistency (program 0710, manpage 0600) reported by Petr Uzel.
 -* The --logfile documentation is now clearer about requiring detached daemon 
 +* The --logfile documentation is now clearer about requiring detached daemon
    mode.
  
  # TRANSLATION UPDATES AND ADDITIONS (ordered by language name):
@@@ -1054,16 -972,16 +1060,16 @@@ fetchmail 6.3.8 (released 2007-04-06)
  
  # BUG FIXES:
  * Fix pluralization of oversized-message warning mails.
 -* Fix manual page: --sslcheck -> --sslcertck, and do not set trailing 
 +* Fix manual page: --sslcheck -> --sslcertck, and do not set trailing
    "recommended:" in bold. Fixes Debian Bug #413059, reported by Rafal Czlonka.
 -* Repoll immediately if a protocol error happens during the authentication 
 +* Repoll immediately if a protocol error happens during the authentication
    attempt after a failed opportunistic TLS upgrade.
    Fixes comment #9 in Gentoo Bug #163782, reported by Takuto Matsuu.
 -* Fix rendering of the "24 - 26, 28, 29" paragraph in the exit codes section. 
 +* Fix rendering of the "24 - 26, 28, 29" paragraph in the exit codes section.
    Reported by Nico Golde.
  * If SOCKS support was compiled in, add 'socks' to the feature_options Python
    list emitted in --configdump. Reported by Rob MacGregor.
 -* Do not crash with a null pointer dereference when opening the BSMTP file 
 +* Do not crash with a null pointer dereference when opening the BSMTP file
    fails. Improve error checking and reporting. Reported by Reto Schüttel,
    Debian Bug#416625. Fix based on a patch by Nico Golde.
  * Make BSMTP output actually work, it would persistently fail with SOCKET error
@@@ -1647,7 -1565,7 +1653,7 @@@ Escalated to "incompatible", 2006-01-13
    Darwin. NetBSD PR#28543 (pkg/28543). Matthias Andree.
  * The RFC-822 parser no longer strips the last character of bare addresses.
    Matthias Andree
 -* The IP address matching code was broken and 
 +* The IP address matching code was broken and
    1. didn't search exhaustively, but matched only the first IP address of the
    server's queryname against the IP addresses of the server name to match.
    2. didn't match IP aliases versus MX hosts.  Matthias Andree
@@@ -1782,7 -1700,7 +1788,7 @@@ fetchmail-6.2.5 (Wed Oct 15 18:39:22 ED
  * OpenSSL cleanup patches from levinedl@acm.org.
  * Benjamin Drieu's patch to fix Debian bug #212240, no oversized-message
    flushing if both "flush" and "limit" were specified.
 -* Benjamin Drieu's patch for Debian bug #156592, incorrect handing of 
 +* Benjamin Drieu's patch for Debian bug #156592, incorrect handing of
    host/port option.
  * Smash all NULs out of headers right after the socket read.
  * Dup-killer code now keys on an MD5 hash of the raw headers.
@@@ -1824,7 -1742,7 +1830,7 @@@ There are 580 people on fetchmail-frien
  fetchmail-6.2.2 (Fri Feb 28 21:34:26 EST 2003), 22345 lines:
  
  * Sunil Shetye's patch to improve behavior on empty messages.
 -* Conform to RFC2595; reissue capability probes after successful 
 +* Conform to RFC2595; reissue capability probes after successful
    STARTTLS negotiation.
  * Sunil's patch to make handling of failed STARTTLS more graceful.
  * Sunil's JF2 fix patch for .fetchmailrc security.
@@@ -1841,7 -1759,7 +1847,7 @@@ fetchmail-6.2.1 (Tue Jan 14 08:17:19 ES
  
  * Updated German, Turkish, Spanish, and Danish translation files.
  * Integrated Sunil Shetye's patch to make mark_seen an explicit method.
 -* Removed FAQ warning about GMX and associated fetchmailconf check, 
 +* Removed FAQ warning about GMX and associated fetchmailconf check,
    we have a report that its servers are conformant now.
  * Another Sunil patch to fix a minor bug in bouncemail generation.
  
@@@ -1861,7 -1779,7 +1867,7 @@@ fetchmail-6.1.3 (Thu Nov 28 05:35:15 ES
  
  * Updated Turkish, Danish, German, Spanish, Catalan po files.
  * Added Slovak support.
 -* Configure.in update for autoconf 2.5 (Art Haas). 
 +* Configure.in update for autoconf 2.5 (Art Haas).
  * Be case-insensitive when looking for IMAP responses.
  * Fix logout-after-idle-delivery bug (Sunil Shetye).
  * Sunil Shetye's patch to bulletproof end-of-header detection.
diff --combined fetchmail-FAQ.html
index 5433220e8f4b7f03f532f948182ee254d5d1890a,ca483fa3e3ba58f1e695f2172191351b83e3be53..5a62cbe8d13983951fc27d17aa63d04a862cbbd9
@@@ -17,7 -17,7 +17,7 @@@ a much better one
  <title>The Fetchmail FAQ</title>
  <meta name="description"
  content="Frequently asked questions about fetchmail."/>
 -<meta name="keywords" content="fetchmail, POP, POP2, POP3, IMAP, remote mail"/>
 +<meta name="keywords" content="fetchmail, POP3, IMAP, remote mail"/>
  </head>
  <body>
  <table width="100%" cellpadding="0" summary="Canned page footer">
@@@ -528,11 -528,11 +528,11 @@@ paper on the Web with a search for tha
  <h2><a id="G8" name="G8">G8. What is the best server to use with
  fetchmail?</a></h2>
  
 -<p>Fetchmail will work with any POP, IMAP, ETRN, or ODMR server
 +<p>Fetchmail will work with any POP3, IMAP, ETRN, or ODMR server
  that conforms to the relevant standards/RFCs (and even some outright
  broken ones like <a href="#S2">Microsoft Exchange</a> and <a
      href="#S6">Novell GroupWise</a>). This doesn't mean it works equally
 -well with all, however. POP2 servers, and POP3 servers without UIDL,
 +well with all, however. POP3 servers without UIDL
  limit fetchmail's capabilities in various ways described on the manual
  page.</p>
  
@@@ -688,7 -688,7 +688,7 @@@ client machine had when it started up.<
  time) doesn't match the original, the most benign possible result
  is that your MTA thinks it's seeing a relaying attempt and refuses.
  More frequently, fetchmail will try to connect to a nonexistent
- host address and time out. Worst case, you could up forwarding your
+ host address and time out. Worst case, you could end up forwarding your
  mail to the wrong machine!</p>
  
  <p>Use the <code>smtpaddress</code> option to force the appended
@@@ -1595,20 -1595,11 +1595,20 @@@ so broken that it's unusable. One sympt
  a terminating newline get the POP3 message termination dot emitted
  -- you guessed it -- right after the last character of the message,
  with no terminating newline added. This will hang fetchmail or any
 -other RFC-compliant server. IMAP is alleged to work OK, though.</p>
 -
 -<p>Older versions of Exchange are semi-usable.  They randomly drop
 -attachments on the floor, though.  Microsoft acknowledges this
 -as a known bug and apparently has no plans to fix it.</p>
 +other RFC-compliant client. IMAP is alleged to work OK, though.</p>
 +
 +<p>Exchange 2003 SP2 has been observed to alter MIME boundary
 +lines in multipart messages between one IMAP FETCH command and the next
 +under some circumstances -- for instance, when the top-level
 +Content-Transfer-Encoding is "binary" (which is commonplace with Perl's
 +MIME::Lite module).  This causes MUAs to not detect attachments, but
 +render the whole message body as one lump of hardly legible to
 +unintelligible text, rather than nicely presenting text part and
 +attachments or images separately.  The cause is that Exchange uses its
 +own message store and needs to convert back to MIME message format
 +on-the-fly, and apparently this is sometimes subject to such
 +inconsistencies.
 +</p>
  
  <p>Fetchmail using IMAP usually supports the proprietary NTLM mode used
  with Microsoft Exchange servers. "Usually" here means that it fails on some
@@@ -1728,6 -1719,9 +1728,6 @@@ explicitly to your mailbox name.</li
  </ul>
  </blockquote>
  
 -<p>But, the best option involves finding a server that runs better
 -software.</p>
 -
  <h2><a id="S3" name="S3">S3. How can I use fetchmail with HP
  OpenMail?</a></h2>
  
@@@ -3555,7 -3549,7 +3555,7 @@@ oversized mails or both when a user spe
  first message in your mailbox. This usually stems from a message like
  the one shown below, which is automatically created on your server. This
  message shows up if the University of Washington IMAP or PINE software
 -is used on the server together with a POP2 or POP3 daemon that is not
 +is used on the server together with a POP3 daemon that is not
  aware of these messages, such as some versions of Qualcomm Popper
  (QPOP):</p>
  
diff --combined fetchmail.h
index 8b5fea90a961f46b10739140a9b34fc8ebf6d86f,466ed86b989cd5bfb4731bb52f357f5a19753a27..10f5be1e5f7576b72c88980368d815eeab451a3c
@@@ -5,45 -5,56 +5,45 @@@
   * For license terms, see the file COPYING in this directory.
   */
  
 -/* We need this for HAVE_STDARG_H, etc */
  #include "config.h"
  
 +#ifdef __NetBSD__
 +#define _NETBSD_SOURCE 1
 +#endif
 +
 +#include "gettext.h"
 +#define GT_(String) gettext (String)
 +#define gettext_noop(String) String
 +#define N_(String) gettext_noop (String)
 +
  struct addrinfo;
  
  /* We need this for size_t */
  #include <sys/types.h>
  
 -/* We need this for time_t */
 -#if TIME_WITH_SYS_TIME
 -# include <sys/time.h>
 -# include <time.h>
 -#else
 -# if HAVE_SYS_TIME_H
 -#  include <sys/time.h>
 -# else
 -#  include <time.h>
 -# endif
 -#endif
 +#include <sys/time.h>
 +#include <time.h>
  
 -#ifdef HAVE_SYS_SOCKET_H
  #include <sys/socket.h>
 -#endif
 -#ifdef HAVE_NET_SOCKET_H
 -#include <net/socket.h>
 -#endif
  #include <netdb.h>
  #include <stdio.h>
  
 -/* Import Trio if needed */
 -#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
 -#  include "trio/trio.h"
 -#endif
 +#include "fm_strl.h"
  
 -/* We need this for strstr */
 -#if !defined(HAVE_STRSTR) && !defined(strstr)
 -char *strstr(const char *, const char *);
 -#endif
 +#include "uid_db.h"
  
 -#include "fm_strl.h"
 +#ifdef HAVE_LIBPWMD
 +#include <libpwmd.h>
 +#endif
  
 -/* constants designating the various supported protocols */
 -#define               P_AUTO          1
 -#define               P_POP2          2
 -#define               P_POP3          3
 -#define               P_APOP          4
 -#define               P_RPOP          5
 -#define               P_IMAP          6
 -#define               P_ETRN          7
 -#define               P_ODMR          8
 +/** constants designating the various supported protocols -- ordered */
 +enum protocols {
 +    P_AUTO = 1        /**< probe IMAP and POP3 - deprecated */,
 +    P_POP3    /**  POP3, including APOP and KPOP, RFC 1939 et al. */,
 +    P_IMAP    /**  IMAP4, RFC 3501 */,
 +    P_ETRN    /**  ETRN - SMTP Service Extension for Remote Message Queue Starting, "extended TURN", RFC 1985 */,
 +    P_ODMR    /**  ODMR/ATRN - On-Demand Mail Relay SMTP with dynamic addresses/Authenticated TURN, RFC 2645 */
 +};
  
  #define               SMTP_PORT       "smtp"
  #define               SMTP_PORT_NUM   25
   */
  #define MAILBOX_PROTOCOL(ctl) ((ctl)->server.protocol < P_ETRN)
  
 -/* authentication types */
 -#define               A_ANY           0       /* use the first method that works */
 -#define               A_PASSWORD      1       /* password authentication */
 -#define               A_NTLM          2       /* Microsoft NTLM protocol */
 -#define               A_CRAM_MD5      3       /* CRAM-MD5 shrouding (RFC2195) */
 -#define               A_OTP           4       /* One-time password (RFC1508) */
 -#define               A_KERBEROS_V4   5       /* authenticate w/ Kerberos V4 */
 -#define               A_KERBEROS_V5   6       /* authenticate w/ Kerberos V5 */
 -#define       A_GSSAPI        7       /* authenticate with GSSAPI */
 -#define               A_SSH           8       /* authentication at session level */
 -#define               A_MSN           9       /* same as NTLM with keyword MSN */
 -#define               A_EXTERNAL      10      /* external authentication (client cert) */
 +/** authentication types */
 +enum authenticators {
 +      A_ANY = 0       /**< use the first method that works */,
 +      A_PASSWORD      /** password authentication */,
 +      A_NTLM          /** Microsoft NTLM protocol */,
 +      A_CRAM_MD5      /** CRAM-MD5 shrouding (RFC2195) */,
 +      A_OTP           /** One-time password (RFC1508) */,
 +      A_APOP          /** POP3 APOP */,
 +      A_KERBEROS_V5   /** authenticate w/ Kerberos V5 */,
 +      A_GSSAPI        /** authenticate with GSSAPI */,
 +      A_SSH           /** authentication at session level */,
 +      A_MSN           /** same as NTLM with keyword MSN */,
 +      A_EXTERNAL      /** external authentication (client cert) */
 +};
  
  /* some protocols or authentication types (KERBEROS, GSSAPI, SSH) don't
   * require a password */
  #define NO_PASSWORD(ctl) \
      ((ctl)->server.authenticate == A_OTP \
 -     || (ctl)->server.authenticate == A_KERBEROS_V4 \
       || (ctl)->server.authenticate == A_KERBEROS_V5 \
       || (ctl)->server.authenticate == A_GSSAPI \
       || (ctl)->server.authenticate == A_SSH \
@@@ -170,9 -180,6 +170,9 @@@ struct runct
      char      *pidfile;       /** where to record the PID of daemon mode processes */
      const char        *postmaster;
      char      *properties;
 +#ifdef HAVE_LIBPWMD
 +    int               pinentry_timeout;
 +#endif
      int               poll_interval;  /** poll interval in seconds (daemon mode, 0 == off) */
      flag      bouncemail;
      flag      spambounce;
@@@ -208,7 -215,7 +208,7 @@@ UID_SEEN=  1,              /**< id was seen, but no
  UID_DELETED=  2,              /**< this message has been marked deleted */
  UID_EXPUNGED= 3               /**< this message has been expunged */
  };
- /*@}*/
+ /**/
  
  
  struct query;
@@@ -251,9 -258,6 +251,9 @@@ struct method              /* describe methods for 
  
  enum badheader { BHREJECT = 0, BHACCEPT };
  
 +/* Message retrieval error mode */
 +enum retrieveerror { RE_ABORT = 0, RE_CONTINUE, RE_MARKSEEN };
 +
  struct hostdata               /* shared among all user connections to given server */
  {
      /* rc file data */
      struct idlist *akalist;           /* server name first, then akas */
      struct idlist *localdomains;      /* list of pass-through domains */
      int protocol;                     /* protocol type */
 -    const char *service;              /* service name */
 +    char *service;                    /* service name */
      int interval;                     /* # cycles to skip between polls */
      int authenticate;                 /* authentication mode to try */
      int timeout;                      /* inactivity timout in seconds */
      char *qvirtual;                   /* prefix removed from local user id */
      flag skip;                                /* suppress poll in implicit mode? */
      flag dns;                         /* do DNS lookup on multidrop? */
 -    flag uidl;                                /* use RFC1725 UIDLs? */
  #ifdef SDPS_ENABLE
      flag sdps;                                /* use Demon Internet SDPS *ENV */
  #endif /* SDPS_ENABLE */
      char *principal;                  /* Kerberos principal for mail service */
      char *esmtp_name, *esmtp_password;        /* ESMTP AUTH information */
      enum badheader badheader;         /* bad-header {pass|reject} */
 +    enum retrieveerror retrieveerror; /* retrieve-error (abort|continue|markseen) */
  
  #if defined(linux) || defined(__FreeBSD__)
  #define CAN_MONITOR
@@@ -325,11 -329,6 +325,11 @@@ struct quer
      char *password;           /* remote password to use */
      struct idlist *mailboxes; /* list of mailboxes to check */
  
 +#ifdef HAVE_LIBPWMD
 +    char *pwmd_socket;                /* socket to connect to */
 +    char *pwmd_file;          /* file to open on the server */
 +#endif
 +
      /* per-forwarding-target data */
      struct idlist *smtphunt;  /* list of SMTP hosts to try forwarding to */
      struct idlist *domainlist;        /* domainlist to fetch from */
      int smtp_socket;          /* socket descriptor for SMTP connection */
      unsigned int uid;         /* UID of user to deliver to */
      struct idlist *skipped;   /* messages skipped on the mail server */
 -    struct idlist *oldsaved, *newsaved;
 -    struct idlist **oldsavedend;
 +    struct uid_db oldsaved, newsaved;
      char lastdigest[DIGESTLEN];       /* last MD5 hash seen on this connection */
      char *folder;             /* folder currently being polled */
  
@@@ -482,11 -482,12 +482,11 @@@ extern const char *iana_charset;        /* IAN
  /* prototypes for globally callable functions */
  
  /* from /usr/include/sys/cdefs.h */
 -#if !defined __GNUC__ || __GNUC__ < 2
 +#if !defined __GNUC__
  # define __attribute__(xyz)    /* Ignore. */
  #endif
  
  /* error.c: Error reporting */
 -#if defined(HAVE_STDARG_H)
  void report_init(int foreground);
   /** Flush partial message, suppress program name tag for next report printout. */
  void report_flush(FILE *fp);
@@@ -502,6 -503,12 +502,6 @@@ void report_complete (FILE *fp, const c
  void report_at_line (FILE *fp, int, const char *, unsigned int, const char *, ...)
      __attribute__ ((format (printf, 5, 6)))
      ;
 -#else
 -void report ();
 -void report_build ();
 -void report_complete ();
 -void report_at_line ();
 -#endif
  
  /* driver.c -- main driver loop */
  void set_timeout(int);
@@@ -528,6 -535,7 +528,6 @@@ int readheaders(int sock
                       int num,
                       flag *suppress_readbody);
  int readbody(int sock, struct query *ctl, flag forward, int len);
 -#if defined(HAVE_STDARG_H)
  void gen_send(int sock, const char *, ... )
      __attribute__ ((format (printf, 2, 3)))
      ;
@@@ -537,6 -545,13 +537,6 @@@ int gen_recv_split(int sock, char *buf
  int gen_transact(int sock, const char *, ... )
      __attribute__ ((format (printf, 2, 3)))
      ;
 -#else
 -void gen_send();
 -int gen_recv();
 -void gen_recv_split_init();
 -int gen_recv_split();
 -int gen_transact();
 -#endif
  extern struct msgblk msgblk;
  
  /* use these to track what was happening when the nonresponse timer fired */
@@@ -577,11 -592,14 +577,11 @@@ int open_sink(struct query*, struct msg
  void release_sink(struct query *);
  int close_sink(struct query *, struct msgblk *, flag);
  int open_warning_by_mail(struct query *);
 -#if defined(HAVE_STDARG_H)
  void stuff_warning(const char *, struct query *, const char *, ... )
      __attribute__ ((format (printf, 3, 4)))
      ;
 -#else
 -void stuff_warning();
 -#endif
  void close_warning_by_mail(struct query *, struct msgblk *);
 +void abort_message_sink(struct query *ctl);
  
  /* rfc822.c: RFC822 header parsing */
  char *reply_hack(char *, const char *, size_t *);
@@@ -639,6 -657,7 +639,6 @@@ int interface_approve(struct hostdata *
  #include "xmalloc.h"
  
  /* protocol driver and methods */
 -int doPOP2 (struct query *); 
  int doPOP3 (struct query *);
  int doIMAP (struct query *);
  int doETRN (struct query *);
@@@ -646,6 -665,7 +646,6 @@@ int doODMR (struct query *)
  
  /* authentication functions */
  int do_cram_md5(int sock, const char *command, struct query *ctl, const char *strip);
 -int do_rfc1731(int sock, const char *command, const char *truename);
  int check_gss_creds(const char *service, const char *hostname);
  int do_gssauth(int sock, const char *command, const char *service, const char *hostname, const char *username);
  int do_otp(int sock, const char *command, struct query *ctl);
  extern char currentwd[1024], rcfiledir[1024];
  
  struct query *hostalloc(struct query *); 
 -int parsecmdline (int, char **, struct runctl *, struct query *);
 +int parsecmdline (int, char **, struct runctl *, struct query *, flag *);
  char *prependdir (const char *, const char *);
  char *MD5Digest (unsigned const char *);
  void hmac_md5 (const unsigned char *, size_t, const unsigned char *, size_t, unsigned char *, size_t);
  int POP3_auth_rpa(char *, char *, int socket);
 -typedef RETSIGTYPE (*SIGHANDLERTYPE) (int);
 +typedef void (*SIGHANDLERTYPE) (int);
  void deal_with_sigchld(void);
 -RETSIGTYPE null_signal_handler(int sig);
 +void null_signal_handler(int sig);
  SIGHANDLERTYPE set_signal_handler(int sig, SIGHANDLERTYPE handler);
  int daemonize(const char *);
  char *fm_getpassword(char *);
@@@ -691,9 -711,34 +691,9 @@@ char *rfc2047e(const char*, const char 
  void yyerror(const char *);
  int yylex(void);
  
 -#ifdef __EMX__
 -void itimerthread(void*);
 -/* Have to include these first to avoid errors from redefining getcwd
 -   and chdir.  They're re-include protected in EMX, so it's okay, I
 -   guess.  */
 -#include <stdlib.h>
 -#include <unistd.h>
 -/* Redefine getcwd and chdir to get drive-letter support so we can
 -   find all of our lock files and stuff. */
 -#define getcwd _getcwd2
 -#define chdir _chdir2
 -#endif /* _EMX_ */
 -
 -#ifdef HAVE_STRERROR
 -#  if !defined(strerror) && !defined(HAVE_DECL_STRERROR)      /* On some systems, strerror is a macro */
 -char *strerror (int);
 -#  endif
 -#endif /* HAVE_STRERROR */
 -
  #define STRING_DISABLED       (char *)-1
  #define STRING_DUMMY  ""
  
 -#ifdef NeXT
 -#ifndef S_IXGRP
 -#define S_IXGRP 0000010
 -#endif
 -#endif
 -
  #ifndef HAVE_STPCPY
  char *stpcpy(char *, const char*);
  #endif