Unexpand tabs in indentation
Add vim modelines
Add the ability to set a custom cipher string

http://www.ietf.org/mail-archive/web/tls/current/msg10471.html

Windows 2003 has a broken TLS stack that
    a) Doesn't implement DES-CBC3-SHA correctly (neither OpenSSL nor GnuTLS
        interoperates with it)
    b) With OpenSSL's default cipherlist always selects DES-CBC3-SHA
        and, if that cipher is excluded, fails to find other supported
        ciphers because it only looks at the first 64 elements of the
        cipherlist.
Add a new TLS policy: DISABLED
Skip invalid MX records

Moved IP address checking to its own function, since it was used in
several places.

MX records were not checked for validity, which (in combination with
another bug) can cause a mail loop on global relays when people have
stupid, broken MX entries:

smtpconnect: DNS blackplanet.com: 2 MX Record Entries
smtpconnect: DNS blackplanet.com: Entry 0: Trying MX preference 10: 127.0.0.1
smtpconnect: Connect.out [127.0.0.1] blackplanet.com: Accepted: <warmbodies.mr.itd.umich.edu>: 220 <warmbodies.mr.itd.umich.edu> Simple Internet Message Transfer Agent ready
smtpconnect: smtp_reply blackplanet.com EHLO: 250-warmbodies.mr.itd.umich.edu Hello warmbodies.mr.itd.umich.edu

After this patch:

smtpconnect: DNS blackplanet.com: 2 MX Record Entries
smtpconnect: DNS blackplanet.com: Entry 0: Invalid MX preference 10: 127.0.0.1
smtpconnect: DNS blackplanet.com: Entry 1: Invalid MX preference 20: 127.0.0.1
smtpconnect: DNS blackplanet.com: DNS exhausted
Fix banner connection loop detection

simta's greeting banner had the hostname in angle brackets, but RFC
2821 (and our connection code) expect it to be just a plain hostname:

DNS blackplanet.com: 2 MX Record Entries
DNS blackplanet.com: Entry 0: Trying MX preference 10: 127.0.0.1
Connect.out [127.0.0.1] blackplanet.com: Accepted: <charliesangels.mr.itd.umich.edu>: 220 <charliesangels.mr.itd.umich.edu> Simple Internet Message Transfer Agent ready
smtp_reply blackplanet.com EHLO: 250-charliesangels.mr.itd.umich.edu Hello charliesangels.mr.itd.umich.edu

After this patch:

DNS blackplanet.com: 2 MX Record Entries
DNS blackplanet.com: Entry 0: Trying MX preference 10: 127.0.0.1
Connect.out [127.0.0.1] blackplanet.com: Failed: banner mail loop: 220 charliesangels.mr.itd.umich.edu Simple Internet Message Transfer Agent ready
Properly consume greeting banners with no text

The connection code was also wrong; it didn't properly handle a plain
reply code and would strdup() gibberish into hq_smtp_hostname:

DNS godfather.dir.itd.umich.edu: MX record has 0 entries, getting A record
DNS godfather.dir.itd.umich.edu: 1 A Record Entries
DNS godfather.dir.itd.umich.edu: Entry 0: Trying A record: 141.211.14.60
Connect.out [141.211.14.60] godfather.dir.itd.umich.edu: Accepted:  �@�: 220

After this patch:

DNS godfather.dir.itd.umich.edu: MX record has 0 entries, getting A record
DNS godfather.dir.itd.umich.edu: 1 A Record Entries
DNS godfather.dir.itd.umich.edu: Entry 0: Trying A record: 141.211.14.60
Connect.out [141.211.14.60] godfather.dir.itd.umich.edu: Accepted: Unknown host: 220

I'm unsure about all the strdup()ing and free()ing here; however, it
works.
Enable ECDHE key exchange

The SSL context needs to be set up with some parameters or else ECDH and
ECDHE cipher suites can't be used.
Log the cipher name after successful STARTTLS
Add ACCEPT R rule
Rework configuration for queue shuffling