]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/patches/ignore_by_smtp_auth
d650ebb98d778713a484ee046290da6131bf85d1
[deb_pkgs/spamass-milter.git] / debian / patches / ignore_by_smtp_auth
1 Description: Add ignore authenticated senders option
2 From: Paul Traina <reportbug@st04.pst.org>
3 Bug: #301755
4 Index: spamass-milter/spamass-milter.1.in
5 ===================================================================
6 --- spamass-milter.orig/spamass-milter.1.in     2012-06-21 12:53:44.000000000 -0700
7 +++ spamass-milter/spamass-milter.1.in  2012-06-21 12:56:56.000000000 -0700
8 @@ -14,6 +14,7 @@
9  .Op Fl e Ar defaultdomain
10  .Op Fl f
11  .Op Fl i Ar networks
12 +.Op Fl I
13  .Op Fl m
14  .Op Fl M
15  .Op Fl P Ar pidfile
16 @@ -119,6 +120,8 @@
17  flags will append to the list.
18  For example, if you list all your internal networks, no outgoing emails
19  will be filtered.
20 +.It Fl I
21 +Ignores messages if the sender has authenticated via SMTP AUTH.
22  .It Fl m
23  Disables modification of the 
24  .Ql Subject: 
25 Index: spamass-milter/spamass-milter.cpp
26 ===================================================================
27 --- spamass-milter.orig/spamass-milter.cpp      2012-06-21 12:53:49.000000000 -0700
28 +++ spamass-milter/spamass-milter.cpp   2012-06-21 12:56:56.000000000 -0700
29 @@ -169,6 +169,7 @@
30  char *spambucket;
31  bool flag_full_email = false;          /* pass full email address to spamc */
32  bool flag_expand = false;      /* alias/virtusertable expansion */
33 +bool ignore_authenticated_senders = false;
34  bool warnedmacro = false;      /* have we logged that we couldn't fetch a macro? */
35  
36  // {{{ main()
37 @@ -177,7 +178,7 @@
38  main(int argc, char* argv[])
39  {
40     int c, err = 0;
41 -   const char *args = "fd:mMp:P:r:u:D:i:b:B:e:x";
42 +   const char *args = "fd:mMp:P:r:u:D:i:Ib:B:e:x";
43     char *sock = NULL;
44     bool dofork = false;
45     char *pidfilename = NULL;
46 @@ -209,6 +210,10 @@
47                                 debug(D_MISC, "Parsing ignore list");
48                                 parse_networklist(optarg, &ignorenets);
49                                 break;
50 +                       case 'I':
51 +                               debug(D_MISC, "Ignore authenticated senders");
52 +                               ignore_authenticated_senders = true;
53 +                               break;
54                         case 'm':
55                                 dontmodifyspam = true;
56                                 smfilter.xxfi_flags &= ~SMFIF_CHGBODY;
57 @@ -276,7 +281,7 @@
58        cout << PACKAGE_NAME << " - Version " << PACKAGE_VERSION << endl;
59        cout << "SpamAssassin Sendmail Milter Plugin" << endl;
60        cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
61 -      cout << "                      [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
62 +      cout << "                      [-e defaultdomain] [-f] [-i networks] [-I] [-m] [-M]" << endl;
63        cout << "                      [-P pidfile] [-r nn] [-u defaultuser] [-x]" << endl;
64        cout << "                      [-- spamc args ]" << endl;
65        cout << "   -p socket: path to create socket" << endl;
66 @@ -290,6 +295,7 @@
67        cout << "   -f: fork into background" << endl;
68        cout << "   -i: skip (ignore) checks from these IPs or netblocks" << endl;
69        cout << "          example: -i 192.168.12.5,10.0.0.0/8,172.16.0.0/255.255.0.0" << endl;
70 +      cout << "   -I: skip (ignore) checks if sender is authenticated" << endl;
71        cout << "   -m: don't modify body, Content-type: or Subject:" << endl;
72        cout << "   -M: don't modify the message at all" << endl;
73        cout << "   -P pidfile: Put processid in pidfile" << endl;
74 @@ -746,6 +753,22 @@
75    }
76    /* debug(D_ALWAYS, "ZZZ got private context %p", sctx); */
77  
78 +  if (ignore_authenticated_senders)
79 +  {
80 +    char *auth_authen;
81 +
82 +    auth_authen = smfi_getsymval(ctx, "{auth_authen}");
83 +    debug(D_MISC, "auth_authen=%s", auth_authen ?: "<unauthenticated>");
84 +
85 +    if (auth_authen)
86 +    {
87 +      debug(D_MISC, "sender authenticated (%s) - accepting message",
88 +           auth_authen);
89 +      debug(D_FUNC, "mlfi_envfrom: exit ignore");
90 +      return SMFIS_ACCEPT;
91 +    }
92 +  }
93 +
94    debug(D_FUNC, "mlfi_envfrom: enter");
95    try {
96      // launch new SpamAssassin