v. 2021.07.28 Patch for simscan-1.4.1 (https://github.com/qmail/simscan/releases) by Roberto Puzzanghera More info at https://notes.sagredo.eu/en/qmail-notes-185/simscan-38.html Simscan doesn't pass messages over 250k to spamassassin. This patch let the administrator set the attachments' size limit in bytes at compilation time configuring in this way autoreconf -f -i (this in needed as configure.ac was modified) configure --with-attachments-size-limit=250000 (default 250k, value must be a number) Furthermore, events where simscan is not activated are now logged at smtpd level (it was logged only when debug is active). Note: this patch is alternative to this one https://notes.sagredo.eu/files/qmail/patches/simscan/simscan-1.4.1_attachments-size-limit_v2.patch which sets the limit by means of the control/simsizelimit file. =================================================================================================== diff -ruN ../simscan-1.4.1_original/configure.ac simscan-1.4.1/configure.ac --- ../simscan-1.4.1_original/configure.ac 2015-01-23 09:57:43.000000000 +0100 +++ simscan-1.4.1/configure.ac 2021-07-26 19:30:10.697857343 +0200 @@ -17,6 +17,23 @@ fi #---------------------------------------------------------------------- +# AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) +AC_ARG_WITH(attachments-size-limit, + [ --with-attachments-size-limit=250000 Attachments with size above the limit in bytes are not passed to spamassassin (default 250k).], + [ + case $withval in + ''|*[0-9]*) AC_MSG_ERROR(attachments-size-limit is not a number) ;; + *) attachments_size_limit="$withval" ;; + esac + ], + attachments_size_limit=250000) + +if [[ "$withval" == "no" ]]; then + attachments_size_limit=2500000 +fi +AC_DEFINE_UNQUOTED(ATTACHMENTS_SIZE_LIMIT,$attachments_size_limit,"") + +#---------------------------------------------------------------------- AC_ARG_ENABLE(user, [ --enable-user= Change the user for simscan. Default: simscan.], ENABLE_USER="$enableval", [ @@ -870,10 +887,10 @@ case $ENABLE_SPAM_AUTH_USER in 0*|n*|N*) - echo "authenticated users scanned = OFF" + echo " authenticated users scanned = OFF" ;; *) - echo "authenticated users scanned = ON" + echo " authenticated users scanned = ON" ;; esac @@ -929,4 +946,7 @@ ;; esac +echo " attachments with size above $attachments_size_limit bytes are not passed to spamassassin" + echo "" + diff -ruN ../simscan-1.4.1_original/simscan.c simscan-1.4.1/simscan.c --- ../simscan-1.4.1_original/simscan.c 2015-01-23 09:57:43.000000000 +0100 +++ simscan-1.4.1/simscan.c 2021-07-26 16:12:55.251161852 +0200 @@ -546,11 +546,11 @@ #endif #ifdef ENABLE_SPAM -if (msgsize >= 250000) { - if ( DebugFlag > 0 ) { +if (msgsize >= ATTACHMENTS_SIZE_LIMIT) { +// if ( DebugFlag > 0 ) { fprintf(stderr, "simscan: big file (%lu bytes); skipping SpamAssassin\n", (unsigned long) msgsize); - } +// } } else { /* re-open the file read only */ if ( (fd = open(message_name, O_RDONLY)) == -1 ) {