-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 John Rudd wrote: > decoder wrote: >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> John Rudd wrote: >>> D.J. wrote: >>>> On 11/10/06, Patrick Sneyers <[EMAIL PROTECTED]> wrote: >>>>> I get this warning: plugin: failed to create instance of plugin >>>>> Mail::SpamAssassin::Plugin::RelayChecker: Can't locate object >>>>> method "new" via package >>>>> "Mail::SpamAssassin::Plugin::RelayChecker" at (eval 26) line 1. >>>>> >>>>> >>>>> (This is my own build of SA 3.1.7 on Max OS X Server 10.4 ppc) >>>>> >>>>> It seems to work OK though: * 3.0 RELAY_CHECKER RELAY: badrdns >>>>> (I lowered the score) >>>>> >>>>> Patrick Sneyers Belgium >>>>> >>>> I also received some weirdness. When linting in debug mode, I >>>> found the following lines that seem to indicate that RelayChecker >>>> isn't playing nicely with FuzzyOCR: >>>> >>>> [28058] dbg: plugin: fixed relative path: >>>> /etc/mail/spamassassin/FuzzyOcr.pm [28058] dbg: plugin: loading >>>> FuzzyOcr from /etc/mail/spamassassin/FuzzyOcr.pm [28058] dbg: >>>> plugin: registered FuzzyOcr=HASH(0x9d04570) [28058] dbg: plugin: >>>> FuzzyOcr=HASH(0x9d04570) implements 'parse_config' [28058] dbg: >>>> FuzzyOcr: Option logfile = >>>> /home/amavis/.spamassassin/FuzzyOcr.log [28058] dbg: FuzzyOcr: >>>> Found scan: $gocr -i $pfile [28058] dbg: FuzzyOcr: Found scan: >>>> $gocr -l 180 -d 2 -i $pfile [28058] dbg: FuzzyOcr: Found scan: >>>> $gocr -l 140 -d 2 -i $pfile [28058] dbg: FuzzyOcr: Option >>>> threshold = 0.25 [28058] dbg: FuzzyOcr: Score{autodisable} = >>>> 10.01 [28058] dbg: FuzzyOcr: Option counts_required = 3 [28058] >>>> dbg: plugin: fixed relative path: >>>> /etc/mail/spamassassin/RelayChecker.pm [28058] dbg: plugin: >>>> loading RelayChecker from /etc/mail/spamassassin/RelayChecker.pm >>>> [28058] dbg: plugin: registered RelayChecker=HASH(0x9d94a80) >>>> [28058] dbg: plugin: FuzzyOcr=HASH(0x9d04570) implements >>>> 'parse_config' [28058] dbg: plugin: RelayChecker=HASH(0x9d94a80) >>>> implements 'parse_config' [28058] dbg: FuzzyOcr: unknown Score: >>>> relaychecker_score [28058] dbg: FuzzyOcr: unknown Option: >>>> relaychecker_skip_nordns [28058] dbg: FuzzyOcr: unknown Option: >>>> relaychecker_skip_badrdns [28058] dbg: FuzzyOcr: unknown Option: >>>> relaychecker_skip_baddns [28058] dbg: FuzzyOcr: unknown Option: >>>> relaychecker_skip_ipinhostname [28058] dbg: FuzzyOcr: unknown >>>> Option: relaychecker_skip_dynhostname [28058] dbg: FuzzyOcr: >>>> unknown Option: relaychecker_skip_clienthostname [28058] dbg: >>>> FuzzyOcr: unknown Option: relaychecker_skip_ip [28058] dbg: >>>> FuzzyOcr: unknown Option: relaychecker_pass_auth >>>> >> Ok that really doesn't look nice... is the fault on our (FuzzyOcr's) >> side? > > Yes. > >> If so, then maybe someone can explain me what the correct way >> would be to fix this :) > > When you encounter an option you don't "own" (ie. it's not a > FuzzyOcr option), then parse_config should return 0. > >> >> If you could verify that this also applies to the latest development >> version (3.4.1), then that would be nice >> > > Yup, I found this in your 3.4.1 code (my comments indicate the issues): Thank you very much for the work, I will patch this into our SVN version and the 3.4.x devel branch right now.
Best regards Chris > > sub parse_config { > my ( $self, $opts ) = @_; > > # this is good: you're restricting yourself to ^focr_bin_ keys > > if ( $opts->{key} =~ /^focr_bin_/i ) { > my $p = lc $opts->{key}; > $p =~ s/focr_bin_//; > if (grep {m/$p/} @bin_utils) { > $App{$p} = $opts->{value}; > debuglog("App{$p} => $App{$p}"); > } else { > debuglog("unknown App: $opts->{key}"); > } > # you should tell SA you processed this config option: > # $self->inhibit_further_callbacks(); > } > > # this is bad: you're processing _score configs that may not belong to > # FuzzyOcr. A better statement might be: > # elsif (($opts->{key} =~ /^focr_/i) && ($opts->{key} =~ > m/_score$/i)) { > # that way you're only processing _score configs that belong to focr > > elsif ( $opts->{key} =~ m/_score$/i ) { > my $o = lc $opts->{key}; > $o =~ s/focr_//; > $o =~ s/_score//; > if (grep {m/$o/} @pgm_scores) { > $Score{$o} = $opts->{value}; > debuglog("Score{$o} = $Score{$o}"); > } else { > debuglog("unknown Score: $opts->{key}"); > } > # again, inhibit further callbacks here: > # $self->inhibit_further_callbacks(); > } > > # same as above: now you're taking ANY key, from ANY plugin, and > handling > # it. Bad bad bad. This should be changed to: > # elsif ($opts->{key} =~ /^focr_/i) { > > else { > my $o = lc $opts->{key}; > $o =~ s/focr_//; > if (grep {m/$o/} @pgm_opts) { > if ($o eq 'scansets') { > @scansets = (); # remove > foreach my $s (split(',',$opts->{value})) { > $s =~ s/^\s*//; $s =~ s/\s*$//; > push @scansets,$s; > debuglog("Found scan: $s"); > } > } elsif ($o eq 'path_bin') { > @paths = (); # remove > foreach my $p (split(':',$opts->{value})) { > next unless -d $p; > push @paths,$p; > debuglog("Valid search path: $p"); > } > } else { > $Option{$o} = $opts->{value}; > debuglog("Option $o = $Option{$o}"); > > } > } else { > debuglog("unknown Option: $opts->{key}"); > } > # one more time: inhibit further callbacks if you've processed the key: > # $self->inhibit_further_callbacks(); > > # here you need to insert an else clause so that SA knows you didn't > # process the given config option > # } else { > # return 0; > > } > > > 1; > } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFFVbBqJQIKXnJyDxURAp3DAJ9xHFOWZ6GrvnsadFqGwQ5Nm4S8tgCfakqv UoqDowyCLN4tPaz4C+ruQrs= =E/ms -----END PGP SIGNATURE-----