corecode/dma — pull request #11 by micia (2012-10-03 20:18:09+00:00)
Title: First experimental implementation of ESMTP, HELO fallback and various improvements

These commits implement basic ESMTP parsing and support, as well as implementing a basic HELO fallback in case everything else fails. The main changes are:
- ESMTP aware connections to remote hosts and separation between config structure and connection (no more ssl in config).
- HELO fallback if possible and if user allows it in the configuration files.
- I/O error checking when reading mails (by testing ferror()).
- Better config file parsing, by ignoring trailing and ending spaces in config files (chomp() function).
- Reworked read_remote() function to be more efficient with less cryptic if guards, while allowing for more flexible external buffer semantics.
- Avoid infinite loops until connection timeout in read_remote(), if the remote host closes the connection on dma (read would return 0, thus pos would be equal to len, causing infinite loops).
- read_remote() now returns full status number rather than status / 100 to allow for more flexible behaviour in mail delivery logic.
- Support for PLAIN authentication.
- Rather than assuming the remote host not to close the connection if dma requires an unsupported feature, now dma parses ESMTP and never sends requests for non advertised features (most SMTP servers will close the connection on an unsupported feature), for example it won't use CRAM MD5 authentication if EHLO response doesn't list it.
- New VERBOSE configuration option to debug network communication between remote host and dma (disabled by default and dangerous for privacy).
- New NOHELO configuration option that disables HELO fallback.
- Minimal configuration file checking (but still very incomplete).
- Other minor fixes, mainly due to code changes, also config files and man page were updated.

These features are not fully tested yet, but using dma on a daily basis I don't see any issue, but a code review and a more in depth test would be necessary.