]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/patches/auth_in_received
45523fb49e838ce52fc34c87d2086ed6c50fc83e
[deb_pkgs/spamass-milter.git] / debian / patches / auth_in_received
1 Description: Include Auth information in the received line
2 Origin: https://www.linuxhacker.at/opensource-projects/spamass-milter
3 Bug: #627989
4 Author: Herbert Straub, Knut Arne Bjørndal <knut.arne.bjorndal@easyconnect.no>
5 Forwarded: no
6 --- a/spamass-milter.cpp
7 +++ b/spamass-milter.cpp
8 @@ -940,7 +940,8 @@
9                    
10                 */
11                 const char *macro_b, *macro_i, *macro_j, *macro_r,
12 -                          *macro_s, *macro_v, *macro_Z, *macro__;
13 +                          *macro_s, *macro_v, *macro_Z, *macro__,
14 +                          *macro_auth_type, *macro_auth_ssf;
15                 char date[32];
16  
17                 /* RFC 822 date. */
18 @@ -977,7 +978,22 @@
19                         macro_r = "SMTP";
20                         warnmacro("r", "ENVRCPT");
21                 }
22 -                       
23 +
24 +               /* Authenticated bits Information */
25 +               macro_auth_type = smfi_getsymval(ctx, "{auth_type}");
26 +               if (!macro_auth_type)
27 +               {
28 +                       macro_auth_type = "";
29 +                       warnmacro("auth_type", "ENVRCPT");
30 +               }
31 +
32 +               macro_auth_ssf = smfi_getsymval(ctx, "{auth_ssf}");
33 +               if (!macro_auth_ssf)
34 +               {
35 +                       macro_auth_ssf = "";
36 +                       warnmacro("auth_ssf", "ENVRCPT");
37 +               }
38 +
39                 /* Sendmail currently cannot pass us the {s} macro, but
40                    I do not know why.  Leave this in for the day sendmail is
41                    fixed.  Until that day, use the value remembered by
42 @@ -1016,11 +1032,22 @@
43                 assassin->output((string)"X-Envelope-From: "+assassin->from()+"\r\n");
44                 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");
45  
46 -               assassin->output((string)
47 -                       "Received: from "+macro_s+" ("+macro__+")\r\n\t"+
48 -                       "by "+macro_j+" ("+macro_v+"/"+macro_Z+") with "+macro_r+" id "+macro_i+"\r\n\t"+
49 +               string rec_header;
50 +               rec_header=(string)"Received: from "+macro_s+" ("+macro__+")\r\n\t";
51 +               if (strlen(macro_auth_type)!=0) {
52 +                       rec_header+=(string)"(authenticated";
53 +                       if (strlen(macro_auth_ssf)!=0) {
54 +                               rec_header+=(string)" bits="+macro_auth_ssf;
55 +                       }
56 +                       rec_header+=(string)")\r\n\t";
57 +               }
58 +               rec_header+=(string)"by "+macro_j+"("+macro_v+"/"+macro_Z+") with "+
59 +                       macro_r+" id "+macro_i+"\r\n\t"+
60                         macro_b+"\r\n\t"+
61 -                       "(envelope-from "+assassin->from()+")\r\n");
62 +                       "(envelope-from "+assassin->from()+"\r\n";
63 +
64 +               debug(D_SPAMC, "Received header for spamc: %s", rec_header.c_str());
65 +               assassin->output(rec_header);
66  
67         } else
68                 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");