]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/patches/ignore_by_smtp_auth
4b7ced0dc4f5f3a9e85ad350d8261e39c93ab85f
[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 --- a/spamass-milter.1.in
5 +++ b/spamass-milter.1.in
6 @@ -15,6 +15,7 @@
7  .Op Fl e Ar defaultdomain
8  .Op Fl f
9  .Op Fl i Ar networks
10 +.Op Fl I
11  .Op Fl m
12  .Op Fl M
13  .Op Fl P Ar pidfile
14 @@ -127,6 +128,8 @@
15  flags will append to the list.
16  For example, if you list all your internal networks, no outgoing emails
17  will be filtered.
18 +.It Fl I
19 +Ignores messages if the sender has authenticated via SMTP AUTH.
20  .It Fl m
21  Disables modification of the 
22  .Ql Subject: 
23 --- a/spamass-milter.cpp
24 +++ b/spamass-milter.cpp
25 @@ -175,6 +175,7 @@
26  char *spambucket;
27  bool flag_full_email = false;          /* pass full email address to spamc */
28  bool flag_expand = false;      /* alias/virtusertable expansion */
29 +bool ignore_authenticated_senders = false;
30  bool warnedmacro = false;      /* have we logged that we couldn't fetch a macro? */
31  bool auth = false;             /* don't scan authenticated users */
32  
33 @@ -184,7 +185,7 @@
34  main(int argc, char* argv[])
35  {
36     int c, err = 0;
37 -   const char *args = "afd:mMp:P:r:u:D:i:b:B:e:xS:R:C:";
38 +   const char *args = "afd:mMp:P:r:u:D:i:Ib:B:e:xS:R:C:";
39     char *sock = NULL;
40     bool dofork = false;
41     char *pidfilename = NULL;
42 @@ -220,6 +221,10 @@
43                  debug(D_MISC, "Parsing ignore list");
44                  parse_networklist(optarg, &ignorenets);
45                  break;
46 +                       case 'I':
47 +                               debug(D_MISC, "Ignore authenticated senders");
48 +                               ignore_authenticated_senders = true;
49 +                               break;
50              case 'm':
51                  dontmodifyspam = true;
52                  smfilter.xxfi_flags &= ~SMFIF_CHGBODY;
53 @@ -296,7 +301,7 @@
54        cout << PACKAGE_NAME << " - Version " << PACKAGE_VERSION << endl;
55        cout << "SpamAssassin Sendmail Milter Plugin" << endl;
56        cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] [-D host]" << endl;
57 -      cout << "                      [-e defaultdomain] [-f] [-i networks] [-m] [-M]" << endl;
58 +      cout << "                      [-e defaultdomain] [-f] [-i networks] [-I] [-m] [-M]" << endl;
59        cout << "                      [-P pidfile] [-r nn] [-u defaultuser] [-x] [-a]" << endl;
60        cout << "                      [-C rejectcode] [ -R rejectmsg ]" << endl;
61        cout << "                      [-- spamc args ]" << endl;
62 @@ -312,6 +317,7 @@
63        cout << "   -f: fork into background" << endl;
64        cout << "   -i: skip (ignore) checks from these IPs or netblocks" << endl;
65        cout << "          example: -i 192.168.12.5,10.0.0.0/8,172.16.0.0/255.255.0.0" << endl;
66 +      cout << "   -I: skip (ignore) checks if sender is authenticated" << endl;
67        cout << "   -m: don't modify body, Content-type: or Subject:" << endl;
68        cout << "   -M: don't modify the message at all" << endl;
69        cout << "   -P pidfile: Put processid in pidfile" << endl;
70 @@ -796,6 +802,22 @@
71        return SMFIS_ACCEPT;
72      }
73    }
74 +
75 +  if (ignore_authenticated_senders)
76 +  {
77 +    char *auth_authen;
78 +
79 +    auth_authen = smfi_getsymval(ctx, "{auth_authen}");
80 +    debug(D_MISC, "auth_authen=%s", auth_authen ?: "<unauthenticated>");
81 +
82 +    if (auth_authen)
83 +    {
84 +      debug(D_MISC, "sender authenticated (%s) - accepting message",
85 +           auth_authen);
86 +      debug(D_FUNC, "mlfi_envfrom: exit ignore");
87 +      return SMFIS_ACCEPT;
88 +    }
89 +  }
90  
91    debug(D_FUNC, "mlfi_envfrom: enter");
92    try {