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