On 10/5/11 10:58 PM, Jan Hauke Rahm wrote: > Hi, > > On Wed, Oct 05, 2011 at 07:27:47PM -0700, David Caldwell wrote: >> I noticed after upgrading my sa-learn-cyrus that I was getting this error: >> 2011-10-05 19:00:03 sa-learn-cyrus[4061] warn: 'bayes_path' not found in >> SA's config '/etc/spamassassin/local.cf'. Assuming '~/.spamassassin/bayes' >> >> This appears to be caused by the removal of the "virtual-users.patch" that >> existed in the 0.3.2 debian package. > > I'm not aware of such a patch. Given that I somehow messed up even > debian/changelog, I might be pretty blind these days, but I really don't > get what you're talking about...
Oh crap, turns out it *wasn't* in the old debian package, I wrote it! (it was a year ago, forgive my memory). For some reason I didn't send it to anyone, so I'll take the opportunity to do so now. Sorry about that! The bug should have been "wishlist" and have a different title. This patch adds a new option to the sa-learn-cyrus config file that is the equivalent of spamassassin spamd's "--virtual-config-dir" command line option. Usually sa-learn-cyrus gets the bayes_path out of spamassassin's config file but when you use the --virtual-config-dir option there ends up being nothing about bayes_path in the spamassassin config file at all. The --virtual-config-dir option lets you do some simple substitutions for virtual users which is necessary in my setup because not all my cyrus mail users are real unix users with home directories. Check the spamd man page or https://spamassassin.apache.org/full/3.0.x/dist/doc/spamd.html for more info. Feeling kind of dumb, David
Index: sa-learn-cyrus-0.3.2/sa-learn-cyrus =================================================================== --- sa-learn-cyrus-0.3.2.orig/sa-learn-cyrus 2010-10-10 23:27:05.000000000 -0700 +++ sa-learn-cyrus-0.3.2/sa-learn-cyrus 2010-10-11 00:10:31.000000000 -0700 @@ -73,6 +73,7 @@ 'sa:group' => 'mail', 'sa:tokens' => '_toks', 'sa:debug' => 'no', + 'sa:virtual_config_dir' => '', # [imap] 'imap:domains' => '', @@ -269,6 +270,14 @@ $learn_path = $imap_mail_path . '/' . $learn_path; if ( -d $learn_path ) { + my $virtual_config_dir; + if ($conf{'sa:virtual_config_dir'}) { + $virtual_config_dir = $conf{'sa:virtual_config_dir'}; + $virtual_config_dir =~ s/%%/%/g; + $virtual_config_dir =~ s/%l/$user/g; + $virtual_config_dir =~ s/%d/$domain/g; + $virtual_config_dir =~ s/%u/$user_domain/g; + } log_msg('info', " Learning $learn from folder '$learn_folder' in path '$learn_path'.") if $OPT{'verbose'} > 0; # sa-learn command parameters my @args; @@ -278,6 +287,8 @@ $args[0] .= " --siteconfigpath=$conf{'sa:site_config_path'}"; $args[0] .= ' --' . $learn; $args[0] .= " --dir $learn_path"; + $args[0] .= " --username='$user'" if $conf{'sa:virtual_config_dir'}; + $args[0] .= " --dbpath=$virtual_config_dir/bayes" if $virtual_config_dir; $args[0] .= " -D" if $conf{'sa:debug'} =~ /^[yY]/; $args[0] .= " 1>$tmp_file"; $args[0] .= ' 2>&1'; @@ -348,7 +359,7 @@ # set uid/gid of bayes tokens file # this may prevent permission problems for spamd my $tokens = $conf{'sa:bayes_path'} . $conf{'sa:tokens'}; -if ( -e $tokens ) { +if ( $conf{'sa:bayes_path'} && -e $tokens ) { log_msg('info', "Tokens in '$tokens'") if $OPT{'verbose'} > 1; my $owner_group = "$conf{'sa:user'}:$conf{'sa:group'}"; unless ( $owner_group eq ':' ) { @@ -616,6 +627,7 @@ } } close(SAC); + return 1 if $conf{'sa:virtual_config_dir'}; log_msg('error', "'bayes_path' not found in '$conf_file'"); return undef; }