Apply the attached patch to the 2.20 check_whitelist, or else just grab the one
I just checked into CVS.  There were more problems which I've fixed than just
the ones in my initial post.

C

Larry Rosenman wrote:

LR> On Wed, 2002-05-01 at 04:17, Craig R Hughes wrote:
LR> > Bart Schaefer wrote:
LR> >
LR> > BS> I just tried this, and (a) it croaks if invoked with perl 5.005 on the
LR> > BS> "use warnings;" line, and (b) with perl 5.6.1, it didn't print anything
LR> > BS> even though a strings of the file shows that there definitely are some
LR> > BS> entries.
LR> >
LR> > Bah!  I don't think we need the use warnings in there anyway.  Consider it gone.
LR> >
LR> > BS> Hmm, this is interesting.  I don't have an auto-whitelist.db file; my
LR> > BS> database appears to be directly in the file named auto-whitelist.  If I
LR> > BS> delete from check_whitelist the
LR> > BS>
LR> > BS> if (-f "$db.db")
LR> >
LR> > Double bah!  I think Justin added that in before heading off on vacation.  It
LR> > doesn't play well with AnyDB which could be using any DB, and not necessarily
LR> > one that calls its files *.db -- I'll remove that line too.
LR> >
LR> > BS> so as to let the block that it protects run, I get
LR> > BS>
LR> > BS> [EMAIL PROTECTED] -> -1.6 (-200.9/127)
LR> > BS>
LR> > BS> but nothing else.  What is supposed to be happening here?  Have I somehow
LR> > BS> gotten a strange version of AnyDBM?
LR> >
LR> > Probably what's happening is you're not using the AWL file you think you're
LR> > using.  Is spamd running as root and not dropping privs?  Try checking out the
LR> > contents of /root/.spamassassin/auto-whitelist.db instead...
LR> >
LR> Here is some results I got:
LR> Script started on Wed May  1 13:40:46 2002
LR> $ cd SpamAssassin/*20
LR> $ ls
LR> Changes             blib                pm_to_blib          spamd
LR> License             build               procmailrc.example  spamproxy
LR> MANIFEST            contrib             qmail               sql
LR> MANIFEST.SKIP       doc                 rules               t
LR> Makefile            fixpath.pl          sample-nonspam.txt  tools
LR> Makefile.PL         lib                 sample-spam.txt     windows_install.pl
LR> README              masses              spamassassin
LR> TODO                ninjabutton.png     spamassassin.raw
LR> $ cd tools
LR> $ ls
LR> check_whitelist  z
LR> $ rm z
LR> $ vi chj eck _whitelist
LR> 7[?47h"check_whitelist" 21 lines, 496 characters 
#!/usr/bin/perl
LR> use warnings ;
LR> use strict ;
LR> use Fcntl;
LR> use AnyDBM_File ;
LR> use vars qw( %h $k $v ) ;
LR> my $db = $ENV{HOME}."/.spamassassin/auto-whitelist";    # is this right?
LR> if (-f "$db.dir") {
LR>   tie %h, "AnyDBM_File",$db, O_RDWR|O_CREAT|O_EXCL,0600
LR> or die "Cannot open file $db: $!\n";
LR>   my @k = grep(!/totscore$/,keys(%h));
LR>   for my $key (@k)
LR>   {
LR>      my $t = $h{"$key|totscore"};
LR> my $v = $h{$key};
LR> if(defined($t)) { printf "%-40.40s -> % 2.1f %s\n",$key,$t/$v,"($t/$v)";
LR>  };
LR>   }
LR>   untie %h;
LR> }
LR> ~"check_whitelist" 21 lines, 496 characters
LR>
LR>
LR>
LR>
LR>
LR>
LR>
LR>
LR> 
LR>
LR>
LR>
LR> ~
LR>
LR>
LR>
LR>
LR>
LR>
LR>
LR>
LR> 
LR>
LR>
LR> ~
LR> "check_whitelist" 19 lines, 474 characters
LR>
LR> [?47l8$ check _wwhitelist
LR> Cannot open file /home/ler/.spamassassin/auto-whitelist: File exists
LR> $ ls -la ..  ~! /.sp/home/ler/.spamassassin/
LR> total 1118
LR> drwx------    2 ler      isis           1024 May  1 13:40 .
LR> drwxr-xr-x  160 ler      other         12288 May  1 13:40 ..
LR> -rw-r--r--    1 ler      isis              0 May  1 11:43 auto-whitelist
LR> -rw-------    1 ler      sys            4096 May  1 08:11 auto-whitelist.dir
LR> -rw-------    1 ler      sys         1007616 May  1 13:40 auto-whitelist.pag
LR> -rw-r--r--    1 ler      isis           1247 Apr 26 17:10 user_prefs
LR> $ rm ~.,  /.sp/home/ler/.spamassassin/auuto-whitelist
LR> $ ls -la /home/ler/.spamassassin/
LR> $ check _whitelist
LR> $
LR> Cannot open file /home/ler/.spamassassin/auto-whitelist: File exists
LR> $ rm /home/ler/.spamassassin/auto-whitelist
LR> $ ls -la /home/ler/.spamassassin/
LR> $
LR> total 1118
LR> drwx------    2 ler      isis           1024 May  1 13:41 .
LR> drwxr-xr-x  160 ler      other         12288 May  1 13:40 ..
LR> -rw-------    1 ler      sys            4096 May  1 08:11 auto-whitelist.dir
LR> -rw-------    1 ler      sys         1007616 May  1 13:41 auto-whitelist.pag
LR> -rw-r--r--    1 ler      isis           1247 Apr 26 17:10 user_prefs
LR> $
LR> script done on Wed May  1 13:42:02 2002
LR>
LR> and I'll attach the check_whitelist I used.
LR>
LR>
LR> > C
LR> >
LR> >
LR> > _______________________________________________________________
LR> >
LR> > Have big pipes? SourceForge.net is looking for download mirrors. We supply
LR> > the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
LR> > _______________________________________________
LR> > Spamassassin-talk mailing list
LR> > [EMAIL PROTECTED]
LR> > https://lists.sourceforge.net/lists/listinfo/spamassassin-talk
LR> >
LR>
Index: tools/check_whitelist
===================================================================
RCS file: /cvsroot/spamassassin/spamassassin/tools/check_whitelist,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tools/check_whitelist       23 Feb 2002 19:07:15 -0000      1.5
+++ tools/check_whitelist       1 May 2002 18:42:29 -0000       1.6
@@ -1,21 +1,19 @@
 #!/usr/bin/perl
-use warnings ;
-use strict ;
+
+use strict;
 use Fcntl;
 use AnyDBM_File ;
 use vars qw( %h $k $v ) ;
 
 my $db = $ENV{HOME}."/.spamassassin/auto-whitelist";   # is this right?
 
-if (-f "$db.db") {
-  tie %h, "AnyDBM_File",$db, O_RDWR|O_CREAT|O_EXCL,0600
+tie %h, "AnyDBM_File",$db, O_RDONLY,0600
       or die "Cannot open file $db: $!\n";
-  my @k = grep(!/totscore$/,keys(%h));
-  for my $key (@k)
-  {
+my @k = grep(!/totscore$/,keys(%h));
+for my $key (@k)
+{
        my $t = $h{"$key|totscore"};
        my $v = $h{$key};
        if(defined($t)) { printf "%-40.40s -> % 2.1f %s\n",$key,$t/$v,"($t/$v)"; };
-  }
-  untie %h;
 }
+untie %h;

Reply via email to