Discussion:
[Mimedefang] return values
Michael Fox
2017-10-06 16:28:32 UTC
Permalink
Perhaps another couple of newbie questions. But I'm having some difficulty
understanding the return actions from filter() and filter_multipart() as
they appear in the example
/usr/share/doc/mimedefang/examples/suggested-minimum-filter-for-windows-clie
nts.gz.

Issue 1: filter and filter_multipart: return value or not?

/usr/bin/mimedefang.pl does not seem to expect a return value from either
filter() or filter_multipart().

if (defined(&filter_multipart)) {
push_status_tag("In filter_multipart routine");
filter_multipart($in, $fname, $extension, $type);
pop_status_tag();
}

if (defined(&filter)) {
push_status_tag("In filter routine");
filter($in, $fname, $extension, $type);
pop_status_tag();
}

. yet in the example "suggested-minimum-filter.", sometimes they return
nothing and sometimes they return a true/false value returned from another
function.

Returns nothing:
return if message_rejected(); # Avoid unnecessary work

Returns result of another function:
return action_accept();

Shouldn't filter() and filter_multipart() simply use "return;" (with no
return value)? If not, please help me understand.



Issue 2: bounce or discard, which is it?

In the "suggested-minimum-filter." filter function, there is this:

# Block message/partial parts
if (lc($type) eq "message/partial") {
md_graphdefang_log('message/partial');
action_bounce("MIME type message/partial not accepted here");
return action_discard();
}

I'm confused by the "return action_discard()". How can it be both bounced
AND discarded?

Thanks,
Michael





_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listi
Dianne Skoll
2017-10-06 17:13:33 UTC
Permalink
Hi,
Post by Michael Fox
Shouldn't filter() and filter_multipart() simply use "return;" (with
no return value)? If not, please help me understand.
The return value of filter and filter_multipart is ignored.
I sometimes write:

return action_accept();

as shorthand for:

action_accept();
return;
Post by Michael Fox
Issue 2: bounce or discard, which is it?
Yeah, that makes no sense. :)
Post by Michael Fox
# Block message/partial parts
if (lc($type) eq "message/partial") {
md_graphdefang_log('message/partial');
action_bounce("MIME type message/partial not accepted here");
return action_discard();
}
Replace return action_discard(); with return;

I will fix the filter.

Regards,

Dianne.
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roa
Michael Fox
2017-10-06 17:49:15 UTC
Permalink
-----Original Message-----
I will fix the filter.
Regards,
Dianne.
Excellent. Thanks.
Michael

_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID. You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list ***@lists.roaringpenguin.com
http://lists.roaringpenguin.com/mailman/listin

Loading...