]> git.donarmstrong.com Git - deb_pkgs/spamass-milter.git/blob - debian/patches/auth_in_received
d81e6226b6a3c1a635bed47c8bd1a2790cc2113a
[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 Index: spamass-milter/spamass-milter.cpp
7 ===================================================================
8 --- spamass-milter.orig/spamass-milter.cpp      2012-06-21 13:03:42.000000000 -0700
9 +++ spamass-milter/spamass-milter.cpp   2012-06-21 14:02:32.000000000 -0700
10 @@ -898,7 +898,8 @@
11                    
12                 */
13                 const char *macro_b, *macro_i, *macro_j, *macro_r,
14 -                          *macro_s, *macro_v, *macro_Z, *macro__;
15 +                          *macro_s, *macro_v, *macro_Z, *macro__,
16 +                          *macro_auth_type, *macro_auth_ssf;
17                 char date[32];
18  
19                 /* RFC 822 date. */
20 @@ -935,7 +936,22 @@
21                         macro_r = "SMTP";
22                         warnmacro("r", "ENVRCPT");
23                 }
24 -                       
25 +
26 +               /* Authenticated bits Information */
27 +               macro_auth_type = smfi_getsymval(ctx, "{auth_type}");
28 +               if (!macro_auth_type)
29 +               {
30 +                       macro_auth_type = "";
31 +                       warnmacro("auth_type", "ENVRCPT");
32 +               }
33 +
34 +               macro_auth_ssf = smfi_getsymval(ctx, "{auth_ssf}");
35 +               if (!macro_auth_ssf)
36 +               {
37 +                       macro_auth_ssf = "";
38 +                       warnmacro("auth_ssf", "ENVRCPT");
39 +               }
40 +
41                 /* Sendmail currently cannot pass us the {s} macro, but
42                    I do not know why.  Leave this in for the day sendmail is
43                    fixed.  Until that day, use the value remembered by
44 @@ -974,11 +990,22 @@
45                 assassin->output((string)"X-Envelope-From: "+assassin->from()+"\r\n");
46                 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");
47  
48 -               assassin->output((string)
49 -                       "Received: from "+macro_s+" ("+macro__+")\r\n\t"+
50 -                       "by "+macro_j+" ("+macro_v+"/"+macro_Z+") with "+macro_r+" id "+macro_i+"\r\n\t"+
51 +               string rec_header;
52 +               rec_header=(string)"Received: from "+macro_s+" ("+macro__+")\r\n\t";
53 +               if (strlen(macro_auth_type)!=0) {
54 +                       rec_header+=(string)"(authenticated";
55 +                       if (strlen(macro_auth_ssf)!=0) {
56 +                               rec_header+=(string)" bits="+macro_auth_ssf;
57 +                       }
58 +                       rec_header+=(string)")\r\n\t";
59 +               }
60 +               rec_header+=(string)"by "+macro_j+"("+macro_v+"/"+macro_Z+") with "+
61 +                       macro_r+" id "+macro_i+"\r\n\t"+
62                         macro_b+"\r\n\t"+
63 -                       "(envelope-from "+assassin->from()+")\r\n");
64 +                       "(envelope-from "+assassin->from()+"\r\n";
65 +
66 +               debug(D_SPAMC, "Received header for spamc: %s", rec_header.c_str());
67 +               assassin->output(rec_header);
68  
69         } else
70                 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");