I'm not totally certain about this part of this commit. See the service_unavailable_error function. It mimics the bad protocol method.
Can someone make sure I'm doing the right thing? Michael On Fri, Mar 05, 2004 at 05:16:19AM -0000, [EMAIL PROTECTED] wrote: > > Modified: incubator/spamassassin/trunk/spamd/spamd.raw > ============================================================================== > --- incubator/spamassassin/trunk/spamd/spamd.raw (original) > +++ incubator/spamassassin/trunk/spamd/spamd.raw Thu Mar 4 21:16:17 2004 > @@ -784,7 +784,10 @@ > } > > if ($opt{'sql-config'} && !defined($current_user)) { > - handle_user_sql('nobody'); > + unless (handle_user_sql('nobody')) { > + service_unavailable_error("Error fetching user preferences via SQL"); > + exit; > + } > } > > if ($opt{'ldap-config'} && !defined($current_user)) { > @@ -983,13 +986,19 @@ > if (!$opt{'user-config'}) > { > if ($opt{'sql-config'}) { > - handle_user_sql($current_user); > + unless (handle_user_sql($current_user)) { > + service_unavailable_error("Error fetching user preferences via SQL"); > + exit; > + } > } elsif ($opt{'ldap-config'}) { > handle_user_ldap($current_user); > } elsif ($opt{'virtual-config'} || $opt{'virtual-config-dir'}) { > handle_virtual_user($current_user); > } elsif ($opt{'setuid-with-sql'}) { > - handle_user_setuid_with_sql($current_user); > + unless (handle_user_setuid_with_sql($current_user)) { > + service_unavailable_error("Error fetching user preferences via SQL"); > + exit; > + } > $setuid_to_user = 1; #to benefit from any paranoia. > } elsif ($opt{'setuid-with-ldap'}) { > handle_user_setuid_with_ldap($current_user); > @@ -1000,7 +1009,10 @@ > { > handle_user($current_user); > if ($opt{'sql-config'}) { > - handle_user_sql($current_user); > + unless (handle_user_sql($current_user)) { > + service_unavailable_error("Error fetching user preferences via SQL"); > + exit; > + } > } > } > return 0; > @@ -1026,6 +1038,13 @@ > logmsg "bad protocol: header error: $err"; > } > > +sub service_unavailable_error { > + my ($err) = @_; > + my $resp = "EX_UNAVAILABLE"; > + print $client "SPAMD/1.0 $resphash{$resp} Service Unavailable: $err\r\n"; > + logmsg "service unavailable: $err"; > +} > + > ########################################################################### > > sub spawn { > @@ -1228,10 +1247,11 @@ > return(1); > } > > -sub handle_user_sql > -{ > - $spamtest->load_scoreonly_sql (@_); > - return 1; > +sub handle_user_sql { > + unless($spamtest->load_scoreonly_sql(@_)) { > + return 0; > + } > + return 1; > } > > sub handle_user_ldap > @@ -1284,7 +1304,9 @@ > } > } > > - $spamtest->load_scoreonly_sql ($username); > + unless ($spamtest->load_scoreonly_sql($username)) { > + return 0; > + } > > $spamtest->signal_user_changed ({ username => $username }); > return 1; >