~ubuntu-branches/ubuntu/saucy/postfix/saucy

« back to all changes in this revision

Viewing changes to src/milter/milter8.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2011-02-22 11:20:43 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20110222112043-c34ht219w3ybrilr
Tags: 2.8.0-2
* a little more lintian cleanup
* Fix missing format strings in smtp-sink.c

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
#define SMFIP_NOUNKNOWN         (1L<<8) /* filter does not want unknown cmd */
210
210
#define SMFIP_NODATA            (1L<<9) /* filter does not want DATA */
211
211
 /* Introduced with Sendmail 8.14. */
212
 
#define SMFIP_SKIP              (1L<<10)/* MTA supports SMFIS_SKIP */
 
212
#define SMFIP_SKIP              (1L<<10)/* MTA supports SMFIR_SKIP */
213
213
#define SMFIP_RCPT_REJ          (1L<<11)/* filter wants rejected RCPTs */
214
214
#define SMFIP_NR_CONN           (1L<<12)/* filter won't reply for connect */
215
215
#define SMFIP_NR_HELO           (1L<<13)/* filter won't reply for HELO */
444
444
  * 
445
445
  * XXX Is this still needed? Sendmail 8.14 provides a proper way to negotiate
446
446
  * what replies the mail filter will send.
 
447
  * 
 
448
  * XXX Keep this table in reverse numerical order. This is needed by the code
 
449
  * that implements compatibility with older Milter protocol versions.
447
450
  */
448
451
static const NAME_CODE milter8_event_masks[] = {
 
452
    "6", MILTER8_V6_PROTO_MASK,
 
453
    "4", MILTER8_V4_PROTO_MASK,
 
454
    "3", MILTER8_V3_PROTO_MASK,
449
455
    "2", MILTER8_V2_PROTO_MASK,
450
 
    "3", MILTER8_V3_PROTO_MASK,
451
 
    "4", MILTER8_V4_PROTO_MASK,
452
 
    "6", MILTER8_V6_PROTO_MASK,
453
456
    "no_header_reply", SMFIP_NOHREPL,
454
457
    0, -1,
455
458
};
1776
1779
        milter->m.flags |= MILTER_FLAG_WANT_RCPT_REJ;
1777
1780
 
1778
1781
    /*
 
1782
     * Allow the remote application to run an older protocol version, but
 
1783
     * don't them send events that their protocol version doesn't support.
 
1784
     * Based on a suggestion by Kouhei Sutou.
 
1785
     * 
 
1786
     * XXX When the Milter sends a protocol version that we don't have
 
1787
     * information for, use the information for the next-lower protocol
 
1788
     * version instead. This code assumes that the milter8_event_masks table
 
1789
     * is organized in reverse numerical order.
 
1790
     */
 
1791
    if (milter->version < my_version) {
 
1792
        const NAME_CODE *np;
 
1793
        int     version;
 
1794
 
 
1795
        for (np = milter8_event_masks; /* see below */ ; np++) {
 
1796
            if (np->name == 0) {
 
1797
                msg_warn("milter %s: unexpected protocol version %d",
 
1798
                         milter->m.name, milter->version);
 
1799
                break;
 
1800
            }
 
1801
            if ((version = atoi(np->name)) > 0 && version <= milter->version) {
 
1802
                milter->np_mask |= (SMFIP_NOSEND_MASK & ~np->code);
 
1803
                if (msg_verbose)
 
1804
                    msg_info("%s: non-protocol events for milter %s"
 
1805
                             " protocol version %d: %s",
 
1806
                             myname, milter->m.name, milter->version,
 
1807
                             str_name_mask_opt(milter->buf,
 
1808
                                               "non-protocol event mask",
 
1809
                                               smfip_table, milter->np_mask,
 
1810
                                               NAME_MASK_NUMBER));
 
1811
                break;
 
1812
            }
 
1813
        }
 
1814
    }
 
1815
 
 
1816
    /*
1779
1817
     * Initial negotiations completed.
1780
1818
     */
1781
1819
    if (msg_verbose) {