Eric - I've been away - looks like an appropriate patch to me.
Dan From: Eric Broch <ebr...@whitehorsetc.com> Sent: Friday, September 21, 2018 2:24 PM To: qmailtoaster-list@qmailtoaster.com Subject: Re: [qmailtoaster] simscan - bad attachment: d I'll ask again, is the qmailtoaster community in agreement that the following patch <http://simscan.inter7.narkive.com/e6pHPXdB/problem-with-attach> (and here <http://gcastrop.blogspot.com/2011/02/problemas-con-adjuntos-en-simscan-con. html> ) should be applied to simscan for qmailtoaster: <patch> --- simscan-1.4.0/simscan.c 2011-02-08 16:00:43.579074836 -0200 +++ simscan-1.4.0-fixed/simscan.c 2011-02-08 16:04:24.931075207 -0200 @@ -1735,10 +1735,14 @@ for(i=0;i<MaxAttach;++i) { if ( DebugFlag > 2 ) fprintf(stderr, "simscan: checking attachment %s against %s\n", mydirent->d_name, bk_attachments[i] ); lowerit(mydirent->d_name); - if ( str_rstr(mydirent->d_name,bk_attachments[i]) == 0 ) { - strncpy(AttachName, mydirent->d_name, sizeof(AttachName)-1); - closedir(mydir); - return(1); + if ( strlen(mydirent->d_name) >= strlen(bk_attachments[i]) ) { + if ( str_rstr(mydirent->d_name,bk_attachments[i]) == 0 ) { + strncpy(AttachName, mydirent->d_name, sizeof(AttachName)-1); + closedir(mydir); + return(1); + } + } else { + if ( DebugFlag > 2 ) fprintf(stderr, "simscan: attachment name '%s' (%d) is shorter than '%s' (%d). IGNORED\n", mydirent->d_name, strlen( mydirent->d_name ), bk_attachments[i], strlen( bk_attachments[i] ) ); } } } </patch> Eric On 9/13/2018 10:02 AM, Michele Federici wrote: Hi, I have done various tests and can confirm the presence of the bug. If the doc attachment created with word 2007 (or other?) is sent through outlook 2003/2007 (or others?), sometimes ripmime wrong to extract the various parts of the email by generating a file "d". # ripmime --disable-qmail-bounce -i test_outlook.eml -d out_dir_res # ls -l ./out_dir_res/ -rw-r--r-- 1 root root 0 13 sep 13.32 d -rw------- 1 root root 442368 13 sep 13.32 mydocument.doc -rw-r--r-- 1 root root 48 13 sep 13.32 textfile0 -rw-r--r-- 1 root root 121 13 sep 13.32 textfile1 -rw-r--r-- 1 root root 167 13 sep 13.32 textfile2 The interesting thing is that: this does not happen with all the doc files but only with some. Simscan 1.4.0 (1.qt.el7) analyzes these files and due to a bug blocks the e-mail with the error "bad attachment: d" I could not replicate the problem with thunderbird: all the emails sent arrived without problems. Probably the correct solution is to compile simscan with the patch indicated in the post by Gustavo Castro. Thank you Michele Il 11/09/2018 12:44, Michele Federici ha scritto: Hi, I've found this error "Your email was rejected because it contains a bad attachment: d" in the smtp log. I read these old post http://qmailtoaster-list.qmailtoaster.narkive.com/u9RF8MRE/your-email-was-re jected-because-it-contains-a-bad-attachment-d http://gcastrop.blogspot.com/2011/02/problemas-con-adjuntos-en-simscan-con.h tml but I did not understand if current simscan 1.4.0 (1.qt.el7) is compiled with the patch. Can you help me? Thank you Michele --------------------------------------------------------------------- To unsubscribe, e-mail: qmailtoaster-list-unsubscr...@qmailtoaster.com <mailto:qmailtoaster-list-unsubscr...@qmailtoaster.com> For additional commands, e-mail: qmailtoaster-list-h...@qmailtoaster.com <mailto:qmailtoaster-list-h...@qmailtoaster.com> --------------------------------------------------------------------- To unsubscribe, e-mail: qmailtoaster-list-unsubscr...@qmailtoaster.com <mailto:qmailtoaster-list-unsubscr...@qmailtoaster.com> For additional commands, e-mail: qmailtoaster-list-h...@qmailtoaster.com <mailto:qmailtoaster-list-h...@qmailtoaster.com> -- Eric Broch White Horse Technical Consulting (WHTC) --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus