XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum [Powered by Invision Power Board]
Printable Version of Topic
Click here to view this topic in its original format
XMail Forum > XMail Server > Must-have Filter To Fix Corrupted Messages


Posted by: hschneider Jul 1 2006, 06:36 AM
QUOTE

This is a small&simple post-data filter to fix the "Zero byte inside the
message" and the "No newline at the end of message" problems. Even though
messages that comes into post-data filters, always have the ending newline
(unless previous filters screw up, of course). Here is the C source code,
and the Win32 pre-built EXE:

http://www.xmailserver.org/xbmf.c
http://www.xmailserver.org/xbmf.exe



- Davide

Sorry, forgot the usage smile.gif

"PATH_TO/xbmf" "@@FILE"



- Davide



Full story here:
http://xmailforum.homelinux.net/index.php?showtopic=3020&st=0

Posted by: catalytical Jul 21 2006, 11:39 AM
Which filter tab do we put this in?

Posted by: hschneider Jul 21 2006, 02:15 PM
filters.post-data.tab

Posted by: hald9000 Jul 26 2006, 02:52 AM
QUOTE (catalytical @ Jul 21 2006, 11:39 AM)

Which filter tab do we put this in?

I am not that familar with all of this scripting stuff. blink.gif What I would like to do is
not have to filter all incoming eMails thereby reducing the load on the server.

Can we use the xbmf.exe in a mailproc.tab as well? If so -- would the syntax be:

"external"[TAB]"0"[TAB]"5"[TAB]"[path]\xbmf.exe"[TAB]"@@FILE"[NEWLINE]

Thanks....

Posted by: hschneider Jul 26 2006, 07:15 AM
No, this is a post-data filter only. Edit filters.post.data.tab and enter:

"PATH_TO/xbmf"[TAB]"@@FILE"[ENTER]

Posted by: hald9000 Jul 31 2006, 09:02 PM
QUOTE (hschneider @ Jul 26 2006, 07:15 AM)
No, this is a post-data filter only. Edit filters.post.data.tab and [snip...]

I'm sorry -- I don't use many of these advanced features. So I'm sorry for the newbie question...

Should the file name be filters.post.data.tab or filters.post-data.tab? Also, the location of the TAB file shoud be the mailroot or the filters sub-folder in the mailroot?

Posted by: hschneider Jul 31 2006, 10:17 PM
Oops .. filters.post-data.tab inside MailRoot.

Posted by: i/you.got.pwned Aug 5 2006, 08:08 PM
QUOTE (hschneider @ Jul 25 2006, 11:15 PM)
No, this is a post-data filter only. Edit filters.post.data.tab and enter:

"PATH_TO/xbmf"[TAB]"@@FILE"[ENTER]

i enter
"PATH_TO/xbmf"[TAB]"@@FILE"[ENTER]
i know i have to modify the file path to point to xbmf, but do i have to change the "@@file" as well?

Posted by: hschneider Aug 6 2006, 07:19 AM
No, @@FILE is a system variable - leave this untouched.

Posted by: ndoeberlein Oct 13 2006, 06:15 AM
Harald,

Would you put this as the first line or would you still run av filter first?

Thanks!

Posted by: hschneider Oct 13 2006, 06:19 AM
This should go into the 1st line.

Posted by: Digdug Jan 24 2007, 08:54 PM
Do we still need this in Xmail v1.24?

Posted by: hschneider Jan 25 2007, 08:05 PM
AFAIK Yes!

Posted by: Digdug Oct 30 2007, 03:53 PM
Can't this be fixed with v1.25? So Xmail always "closes" the messages?

(A -very- late response)

I know it's not Xmail causing the problem, but it would be nice not to use the filter anymore... Maybe a SERVER.TAB variable?

Posted by: hschneider Oct 30 2007, 04:55 PM
I once requested this at Davide. His point of view was that a SMTP server should not alter messages by default. So this task is delegated to the filter framework.

Posted by: oytunsan Nov 19 2007, 09:56 AM
Hi,


Is there a way to apply this exe to already existing messages in the domains folder?

Maybe I can write a small dos script if this exe can run on any mail file under mailroot\domains\domain.com\user\mailbox

thanks in advance
oytun

Posted by: hschneider Nov 19 2007, 10:15 AM
No - it is a pure SMTP level fílter.
You'll have to replace nullbytes and to add missing ending linefeeds from your own code.

You can also use and/or modify my nukemalformed script here:
http://xmailforum.homelinux.net/index.php?showtopic=3020&hl=dos-attack&st=15

Direct download here: http://xmailforum.homelinux.net/index.php?act=Attach&type=post&id=17004

-- Harald

Posted by: MasteRtR Jan 7 2008, 01:27 PM
if you want to delete malformed emails, i suggest you use hschneider's perl script with these codes. (attached)

CODE

sub procFiles() {

my $f = shift;

 open(FILE, "< $f");
 binmode(FILE);
 local $/;
 $c = <FILE>;
 close(FILE);
   if($c =~ /\x00/) {
   print "$f\n";
   unlink($f) if $REMOVE == 1;
  }


#added by murat surucu
my @data;
my $length = -2;
open(FILE, "< $f");
binmode(FILE);
local $/;
seek (FILE,$length,2);
@data = <FILE>;
close(FILE);
$hexdata=unpack ("H*", $data[0]);
if($hexdata != "0d0a" ) { #or 0d0a0d0a
   print "$f\n";
   unlink($f) if $REMOVE == 1;
}
}

Posted by: Don Feb 5 2008, 10:16 PM
Hi,

Newbie Linux/Xmail question.

Where does the filter file go (xbmf.c)? In the filters folder? Does anything need to be done with it (compile) or leave it just as a C file.

Thanks
Don

Posted by: Don Feb 8 2008, 06:12 PM
QUOTE (Don @ Feb 5 2008, 05:16 PM)
Hi,

Newbie Linux/Xmail question.

Where does the filter file go (xbmf.c)? In the filters folder? Does anything need to be done with it (compile) or leave it just as a C file.

Thanks
Don

Hi Harald,

Can you respond please. This is for Linux.

Thanks!
Don

Posted by: sc4vengr Feb 8 2008, 07:28 PM
QUOTE (Don @ Feb 8 2008, 06:12 PM)
QUOTE (Don @ Feb 5 2008, 05:16 PM)
Hi,

Newbie Linux/Xmail question.

Where does the filter file go (xbmf.c)? In the filters folder? Does anything need to be done with it (compile) or leave it just as a C file.

Thanks
Don

Hi Harald,

Can you respond please. This is for Linux.

Thanks!
Don

Try this procedure:

#cd /var/MailRoot/filters
#mkdir xbmf
#wget http://www.xmailserver.org/xbmf.c
#gcc xbmf.c -o xbmf
#pico /var/Mailroot/filters.post-data.tab

Add a line like this one:

"/var/MailRoot/filters/xbmf/xbmf"[TAB]"@@FILE"[NEWLINE]

Of course replace [TAB] with the TAB key and NEWLINE with ENTER

Hope this helps

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)