1 Description: Include Auth information in the received line
2 Origin: https://www.linuxhacker.at/opensource-projects/spamass-milter
4 Author: Herbert Straub, Knut Arne Bjørndal <knut.arne.bjorndal@easyconnect.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
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;
22 warnmacro("r", "ENVRCPT");
26 + /* Authenticated bits Information */
27 + macro_auth_type = smfi_getsymval(ctx, "{auth_type}");
28 + if (!macro_auth_type)
30 + macro_auth_type = "";
31 + warnmacro("auth_type", "ENVRCPT");
34 + macro_auth_ssf = smfi_getsymval(ctx, "{auth_ssf}");
35 + if (!macro_auth_ssf)
37 + macro_auth_ssf = "";
38 + warnmacro("auth_ssf", "ENVRCPT");
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
45 assassin->output((string)"X-Envelope-From: "+assassin->from()+"\r\n");
46 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");
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"+
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;
58 + rec_header+=(string)")\r\n\t";
60 + rec_header+=(string)"by "+macro_j+"("+macro_v+"/"+macro_Z+") with "+
61 + macro_r+" id "+macro_i+"\r\n\t"+
63 - "(envelope-from "+assassin->from()+")\r\n");
64 + "(envelope-from "+assassin->from()+"\r\n";
66 + debug(D_SPAMC, "Received header for spamc: %s", rec_header.c_str());
67 + assassin->output(rec_header);
70 assassin->output((string)"X-Envelope-To: "+envrcpt[0]+"\r\n");