[Mimedefang] Allowing ONLY certain extensions

Steven Rocha steven.rocha at wccnetworking.com
Sat Mar 6 04:05:14 EST 2004


All,

Had a client that only wanted an extension they made up to be allowed
in. I perform this check right after my virus checks, but I suppose I
could do it before to save come CPU cycles.  Here is the code if anyone
else wants to use it.  Had to use the $fname eq "" because the first
part that processes does not have any attachment information.

In sub filter    

    $Domain = lc($Domain);
    if ($fname eq "") {
        #Do Nothing
    } else {
        if ($Domain eq "domainname.com") {
            if ($fname =~ /.xxx/i) {
                md_log('goodext', $fname, $type);
                return action_accept();
            } else {
                md_log('badext', $fname, $type);
                return action_discard();
            }
        }
    }


As always, comments are welcome!

Steven Rocha





More information about the MIMEDefang mailing list