Your message dated Fri, 19 Dec 2025 04:19:19 +0000
with message-id <[email protected]>
and subject line Bug#1031196: fixed in spamass-milter 0.4.0-5
has caused the Debian Bug report #1031196,
regarding spamass-milter: 'Could not retrieve sendmail macro "b"' with postfix: 
PATCH
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
1031196: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1031196
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: spamass-milter
Version: 0.4.0-2
Followup-For: Bug #1004485
X-Debbugs-Cc: [email protected]
Control: tags -1 patch

Dear maintainer,

In this patch I've included a fix for this problem, which includes a new option 
for the /etc/default config. By default it is commented out so that the 
behaviour doesn't change.

This introduces the -Y command line flag for "postfix compatibility mode" which 
explicitly sets default values for macros which postfix doesn't support, or 
doesn't support in the ENVRCPT context.

There's another hidden issue here: when using spamass-milter this way with 
postfix, it doesn't support the {auth_type} macro in the ENVRCPT context, which 
is handled by function mlfi_envrcpt(). The fallback there is to always assume 
unauthenticated sender. This is fine if you don't spamfilter mail from 
authenticated users. However it would be problematic in a scenario where 
someone wants to spamfilter incoming mail from authenticated users but has some 
spamassassin rules that change the score based on whether the sender is 
authenticated or not - which is the whole reason why all those bits of 
information are requested from the MTA using macros and included for 
spamassassin in the first place. You only see the 'b' macro and never the 
'{auth_type}' macro failing because 'b' is requested first.

Therefore I've made the -Y dependend on the -I flag ("don't filter mail by 
authenticated users"), to make this behaviour explicit and visible.

The patch doesn't fix the cut-off manpage part for -x (which might be more 
visible with this change), nor the broken indendation in some places, and uses 
code style of surrounding code.

On a side note:
> It goes away if I add b to milter_rcpt_macros, so presumably that should be 
> added to the README.

This is wrong and does not work with postfix.



*** fix-1004485.patch
---
 debian/spamass-milter.default |  4 ++
 spamass-milter.1.in           |  7 +++
 spamass-milter.cpp            | 81 +++++++++++++++++++++++++----------
 3 files changed, 69 insertions(+), 23 deletions(-)

diff --git a/debian/spamass-milter.default b/debian/spamass-milter.default
index 8922fb5..d94f99a 100644
--- a/debian/spamass-milter.default
+++ b/debian/spamass-milter.default
@@ -17,6 +17,10 @@ OPTIONS="-u spamass-milter -i 127.0.0.1"
 # Do not modify Subject:, Content-Type: or body.
 #OPTIONS="${OPTIONS} -m"
 
+# Postfix compatibility mode for before-queue-filtering
+# only filter mail from unauthenticated senders
+#OPTIONS="${OPTIONS} -Y -I"
+
 ######################################
 # If /usr/sbin/postfix is executable, the following are set by
 # default. You can override them by uncommenting and changing them
diff --git a/spamass-milter.1.in b/spamass-milter.1.in
index dfe56ba..c10836a 100644
--- a/spamass-milter.1.in
+++ b/spamass-milter.1.in
@@ -23,6 +23,7 @@
 .Op Fl r rejectmsg
 .Op Fl u Ar defaultuser
 .Op Fl x
+.Op Fl Y
 .Op Fl S /path/to/sendmail
 .Op Fl - Ar spamc flags ...
 .Sh DESCRIPTION
@@ -221,6 +222,12 @@ Requires the
 flag.  The spamass-milter configuration process does its
 best to find sendmail, but it is possible to override this compiled-in
 setting via the
+.It Fl Y
+Postfix pre-queue compatibility mode. Uses default values for sendmail
+macros which Postfix doesn't support. Assumes all filtered messages
+originate from unauthenticated clients, therefore requires
+.Fl I
+flag.
 .It Fl - Ar spamc flags ...
 Pass all remaining options to spamc. 
 This allows you to connect to a remote spamd with
diff --git a/spamass-milter.cpp b/spamass-milter.cpp
index fdda5f0..e376df8 100644
--- a/spamass-milter.cpp
+++ b/spamass-milter.cpp
@@ -178,6 +178,7 @@ bool flag_expand = false;   /* alias/virtusertable 
expansion */
 bool ignore_authenticated_senders = false;
 bool warnedmacro = false;      /* have we logged that we couldn't fetch a 
macro? */
 bool auth = false;             /* don't scan authenticated users */
+bool postfix_compat = false;   /* replace some sendmail macros with default 
values */
 
 // {{{ main()
 
@@ -185,7 +186,7 @@ int
 main(int argc, char* argv[])
 {
    int c, err = 0;
-   const char *args = "afd:mMp:P:r:u:D:i:Ib:B:e:xS:R:C:";
+   const char *args = "afd:mMp:P:r:u:D:i:Ib:B:e:xS:R:C:Y";
    char *sock = NULL;
    bool dofork = false;
    char *pidfilename = NULL;
@@ -281,6 +282,9 @@ main(int argc, char* argv[])
             case 'x':
                 flag_expand = true;
                 break;
+            case 'Y':
+                postfix_compat = true;
+                break;
             case '?':
                 err = 1;
                 break;
@@ -293,6 +297,12 @@ main(int argc, char* argv[])
       err=1;
    }
 
+   if (postfix_compat && !ignore_authenticated_senders)
+   {
+         fprintf(stderr, "-Y flag requires -I\n");
+      err=1;
+   }
+
    /* remember the remainer of the arguments so we can pass them to spamc */
    spamc_argc = argc - optind;
    spamc_argv = argv + optind;
@@ -302,7 +312,7 @@ main(int argc, char* argv[])
       cout << "SpamAssassin Sendmail Milter Plugin" << endl;
       cout << "Usage: spamass-milter -p socket [-b|-B bucket] [-d xx[,yy...]] 
[-D host]" << endl;
       cout << "                      [-e defaultdomain] [-f] [-i networks] 
[-I] [-m] [-M]" << endl;
-      cout << "                      [-P pidfile] [-r nn] [-u defaultuser] 
[-x] [-a]" << endl;
+      cout << "                      [-P pidfile] [-r nn] [-u defaultuser] 
[-x] [-Y] [-a]" << endl;
       cout << "                      [-C rejectcode] [ -R rejectmsg ]" << endl;
       cout << "                      [-- spamc args ]" << endl;
       cout << "   -p socket: path to create socket" << endl;
@@ -327,6 +337,7 @@ main(int argc, char* argv[])
       cout << "   -u defaultuser: pass the recipient's username to spamc.\n"
               "          Uses 'defaultuser' if there are multiple recipients." 
<< endl;
       cout << "   -x: pass email address through alias and virtusertable 
expansion." << endl;
+      cout << "   -Y: use default values for sendmail macros not supported by 
postfix." << endl;
       cout << "   -a: don't scan messages over an authenticated connection." 
<< endl;
       cout << "   -- spamc args: pass the remaining flags to spamc." << endl;
               
@@ -934,22 +945,28 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt)
                char date[32];
 
                /* RFC 822 date. */
-               macro_b = smfi_getsymval(ctx, const_cast<char *>("b"));
-               if (!macro_b)                                  
+               /* Postfix doesn't support the 'get current timestamp' macro. */
+               if (!postfix_compat)
+                       macro_b = smfi_getsymval(ctx, const_cast<char *>("b"));
+               if (postfix_compat || !macro_b)                                 
 
                {
                        time_t tval;
                        time(&tval);
                        strftime(date, sizeof(date), "%a, %d %b %Y %H:%M:%S 
%z", localtime(&tval));
                        macro_b = date;
-                       warnmacro("b", "ENVRCPT");
+                       if (!postfix_compat)
+                               warnmacro("b", "ENVRCPT");
                }
 
                /* queue ID */
-               macro_i = smfi_getsymval(ctx, const_cast<char *>("i"));
-               if (!macro_i)
+               /* Postfix doesn't assign a queue id at rcpt stage yet 
(sendmail does) */
+               if (!postfix_compat)
+                       macro_i = smfi_getsymval(ctx, const_cast<char *>("i"));
+               if (postfix_compat || !macro_i)
                {
                        macro_i = "unknown";
-                       warnmacro("i", "ENVRCPT");
+                       if (!postfix_compat)
+                               warnmacro("i", "ENVRCPT");
                }
 
                /* FQDN of this site */
@@ -961,26 +978,38 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt)
                }
 
                /* Protocol used to receive the message */
-               macro_r = smfi_getsymval(ctx, const_cast<char *>("r"));
-               if (!macro_r)
+               /* Postfix doesn't support the 'protocol type' macro, assume 
SMTP */
+               if (!postfix_compat)
+                       macro_r = smfi_getsymval(ctx, const_cast<char *>("r"));
+               if (postfix_compat || !macro_r)
                {
                        macro_r = "SMTP";
-                       warnmacro("r", "ENVRCPT");
+                       if (!postfix_compat)
+                               warnmacro("r", "ENVRCPT");
                }
 
                /* Authenticated bits Information */
-               macro_auth_type = smfi_getsymval(ctx, "{auth_type}");
-               if (!macro_auth_type)
+               /* Postfix doesn't support the 'authentication type' macro at 
RCPT stage */
+               /* Assume no auth, as only mails by unauth senders are 
filtered. */
+               if (!postfix_compat)
+                       macro_auth_type = smfi_getsymval(ctx, "{auth_type}");
+               if (postfix_compat || !macro_auth_type)
                {
                        macro_auth_type = "";
-                       warnmacro("auth_type", "ENVRCPT");
+                       if (!postfix_compat)
+                               warnmacro("auth_type", "ENVRCPT");
                }
 
-               macro_auth_ssf = smfi_getsymval(ctx, "{auth_ssf}");
-               if (!macro_auth_ssf)
+               /* Postfix doesn't support the
+                  'authenticated connection encryption mechanism strength in 
bits' macro
+               */
+               if (!postfix_compat)
+                       macro_auth_ssf = smfi_getsymval(ctx, "{auth_ssf}");
+               if (postfix_compat || !macro_auth_ssf)
                {
                        macro_auth_ssf = "";
-                       warnmacro("auth_ssf", "ENVRCPT");
+                       if (!postfix_compat)
+                               warnmacro("auth_ssf", "ENVRCPT");
                }
 
                /* Sendmail currently cannot pass us the {s} macro, but
@@ -988,8 +1017,10 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt)
                   fixed.  Until that day, use the value remembered by
                   mlfi_helo()
                */
-               macro_s = smfi_getsymval(ctx, const_cast<char *>("s"));
-               if (!macro_s)
+               /* Postfix doesn't support the 'sender host name' macro either 
*/
+               if (!postfix_compat)
+                       macro_s = smfi_getsymval(ctx, const_cast<char *>("s"));
+               if (postfix_compat || !macro_s)
                        macro_s = sctx->helo;
                if (!macro_s)
                        macro_s = "nohelo";
@@ -1003,8 +1034,11 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt)
                }
 
                /* Sendmail .cf version */
-               macro_Z = smfi_getsymval(ctx, const_cast<char *>("Z"));
-               if (!macro_Z)
+               /* Postfix doesn't support the 'sendmail config file version' 
macro */
+               /* Instead of taking a default value, leave out this part of 
the header. */
+               if (!postfix_compat)
+                       macro_Z = smfi_getsymval(ctx, const_cast<char *>("Z"));
+               if (!postfix_compat && !macro_Z)
                {
                        macro_Z = "8.13.0";
                        warnmacro("Z", "ENVRCPT");
@@ -1030,8 +1064,9 @@ mlfi_envrcpt(SMFICTX* ctx, char** envrcpt)
                        }
                        rec_header+=(string)")\r\n\t";
                }
-               rec_header+=(string)"by "+macro_j+" ("+macro_v+"/"+macro_Z+") 
with "+
-                       macro_r+" id "+macro_i+"\r\n\t"+
+               rec_header+=(string)"by "+macro_j+" ("+macro_v+
+                       (postfix_compat?"":(string)"/"+macro_Z)+
+                       ") with "+macro_r+" id "+macro_i+"\r\n\t"+
                        macro_b+"\r\n\t"+
                        "(envelope-from "+assassin->from()+");\r\n";
 
-- 
2.30.2



-- System Information:
Debian Release: 11.5
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-19-amd64 (SMP w/1 CPU thread)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages spamass-milter depends on:
ii  adduser         3.118
ii  libc6           2.31-13+deb11u5
ii  libgcc-s1       10.2.1-6
ii  libmilter1.0.1  8.15.2-22
ii  libstdc++6      10.2.1-6
ii  spamc           3.4.6-1

Versions of packages spamass-milter recommends:
ii  postfix       3.5.13-0+deb11u1
ii  spamassassin  3.4.6-1

spamass-milter suggests no packages.

-- Configuration Files:
/etc/default/spamass-milter changed [not included]

-- no debconf information

--- End Message ---
--- Begin Message ---
Source: spamass-milter
Source-Version: 0.4.0-5
Done: Don Armstrong <[email protected]>

We believe that the bug you reported is fixed in the latest version of
spamass-milter, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Don Armstrong <[email protected]> (supplier of updated spamass-milter package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Thu, 18 Dec 2025 19:52:41 -0800
Source: spamass-milter
Architecture: source
Version: 0.4.0-5
Distribution: unstable
Urgency: medium
Maintainer: Don Armstrong <[email protected]>
Changed-By: Don Armstrong <[email protected]>
Closes: 949370 1004485 1031196 1121631
Changes:
 spamass-milter (0.4.0-5) unstable; urgency=medium
 .
   * Fix typo in postinst when adding spamass-milter to postfix.
     Thanks to Michael Milligan (Closes: #1121631)
   * Synthesize macro $b using the current time.
     Thanks to Bjørn Mork (Closes: #949370, #1031196, #1004485)
Checksums-Sha1:
 28e31dbc9792b3a79252e2ea32292a0e8df0edf0 1922 spamass-milter_0.4.0-5.dsc
 6c7a7f11cb8e37612d5ff5a6c332ec1f3da3ceaa 14932 
spamass-milter_0.4.0-5.debian.tar.xz
 8aa99fbdef35b85ba9dc0af3148f4c3d0aa8652d 6479 
spamass-milter_0.4.0-5_amd64.buildinfo
Checksums-Sha256:
 7ee08fb66d75a7eeb675192c48ed027d0948fdb5447b20bdf5260fa3bdf6ecf5 1922 
spamass-milter_0.4.0-5.dsc
 066fad763ae69838b3277d424dd4a4944b8e751a71e735439ffb61e082427d31 14932 
spamass-milter_0.4.0-5.debian.tar.xz
 18515171c00e428c50b8b993a1d6a0d9e9e0e899fd6d7bd6f62eb99266034250 6479 
spamass-milter_0.4.0-5_amd64.buildinfo
Files:
 079b4dc8dd1cae4f9894c641e085015f 1922 mail optional spamass-milter_0.4.0-5.dsc
 4710a3181ada180309c41f65d6fdfa09 14932 mail optional 
spamass-milter_0.4.0-5.debian.tar.xz
 00499822876ae56a3f721890b5e3acf0 6479 mail optional 
spamass-milter_0.4.0-5_amd64.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE5LM+VK44JFjLfWEcOHr4psy3gqMFAmlEzZAACgkQOHr4psy3
gqP24w/+IWoU6VA7ocVzdlB9c1j4VgVZc95HvAXBpaGFOawqn/XNGXKIhxt1+Jc9
nfdb0ZCWeAX/BPWGtwIOK48jci+ezizybQdbl/5C5mVevlBO2b70pwyU68mf7PFK
LRDtHqc+y4C8lRvRocSI36iVuTEvVaqLur2yvTFVCbwppTPbh/wMbab6R4dUCuFP
gX8m74pRWkzvkqkiAC4YqBGj9A/yvUTuwuNScWqoc6BKlBEjRq1Lofsadp9UKXnt
3vJWZqNVnyucmVxkxTrx8SEZFN3KGmOmJ9fwiT8LcQThxUjXC57+o+O493kaVns7
mR9RycFv0vky3jd9AdPmsWk2UGCxvJfa+WVdi/po3MrBjjngsYRuC0+PbV9wd+R7
+L6Fe087QbfNvjhbKh1l2SRjBcXCa2mOiCuAnvoLWk/AnTI2jEyrJklbpB/9VHM3
EWXKhfy7NLSUQg1NCiwvaf+Z54NHDTuJgiv1cdmbtf98T5MJiOEwLy8ZoQGkBpJ/
iBEltB/VdcPu+o4o/JH8bxv8k5igFqOPcyxMsWm39gCvmHfuNudQ/0luGCm3ZDTF
VXRETmIN5rDFk0e9do24JyJx6O5vgJP4Zbk4wKA6a+oOzPXzYGfeTtN7qjx8xzZD
HmMyhkg3ODPJgpvPEm8QqJ8YSTD2XWy73WhF9SK1aSxrVKBEFw8=
=Ai+u
-----END PGP SIGNATURE-----

Attachment: pgpLraEYg7mGr.pgp
Description: PGP signature


--- End Message ---

Reply via email to