[Mimedefang] Re: tripping up in percent_decode ()

Jan Pieter Cornet johnpc at xs4all.nl
Fri Jun 17 03:26:40 EDT 2005


On Thu, Jun 16, 2005 at 12:12:14PM -0800, Royce Williams wrote:
> Issue on my side, though I'm not sure why it failed in this way.
> 
> Turns out that a variable I was using to construct a custom header
> was outside any functions in my filter, so it wasn't showing up
> when I switched to embedded Perl on this system.

That should not happen when you use embedded perl, there's no
"issue" with variables outside of functions like there is in
apache mod_perl's Apache::Registry.

Maybe you just didn't initialize the variable? Are you by chance
initializing a variable during filter_recipient and then using that
variable in filter_end or something? That is known not to work.
See "GLOBAL VARIABLE LIFETIME" in the mimedefang-filter manpage.

> It is odd, though, that my call to action_change header had a second
> variable that was declared with 'use vars' but hadn't been set to
> anything yet.  action_change_header happily accepts this and tries
> to use it (resulting in the error), even though action_change_header
> appears to want to require two arguments:
> 
> $ egrep '^sub action_change_header' /usr/local/bin/mimedefang.pl
> sub action_change_header ($$;$) {
> 
> David, shouldn't mimedefang.pl have thrown a "not enough arguments"
> error if the second argument was only "use vars"'d?  Or am I showing
> my Perl lack-of-clue?

No, it is perfectly legal in perl to pass an "undef" value to a function.
The "not enough arguments" is a compile-time error if you'd use
    action_change_header( $foo );

If you call action_change_header with an undef or empty $val, though,
then it might decide to act like action_delete_header, or throw a
warning (which it did, albeit a cryptic one :)...

-- 
#!perl -wpl # mmfppfmpmmpp mmpffm <pmmppfmfpppppfmmmf at fpffmm4mmmpmfpmf.ppppmf>
$p=3-2*/[^\W\dmpf_]/i;s.[a-z]{$p}.vec($f=join('',$p-1?chr(sub{$_[0]*9+$_[1]*3+
$_[2]}->(map{/p|f/i+/f/i}split//,$&)+97):qw(m p f)[map{((ord$&)%32-1)/$_%3}(9,
3,1)]),5,1)='`'lt$&;$f.eig;                                # Jan-Pieter Cornet



More information about the MIMEDefang mailing list