You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by ms...@apache.org on 2004/12/02 21:34:54 UTC

svn commit: r109534 - /spamassassin/trunk/spamd/spamd.raw

Author: mss
Date: Thu Dec  2 12:34:53 2004
New Revision: 109534

URL: http://svn.apache.org/viewcvs?view=rev&rev=109534
Log:
* Bail out if the user tries to create a socket on a regular file
* Some dbg() cleanup

Modified:
   spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/spamd/spamd.raw
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/spamd/spamd.raw?view=diff&rev=109534&p1=spamassassin/trunk/spamd/spamd.raw&r1=109533&p2=spamassassin/trunk/spamd/spamd.raw&r2=109534
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw	(original)
+++ spamassassin/trunk/spamd/spamd.raw	Thu Dec  2 12:34:53 2004
@@ -636,8 +636,11 @@
   # certainly a better way, but we don't know it. Yet.
 
   if ( -e $path ) {
+    unless ( -S $path ) {
+      die "file $path exists but is no socket, exiting\n";
+    }
+  
     if ( new IO::Socket::UNIX( Peer => $path, Type => SOCK_STREAM ) ) {
-
       # we connected successfully: must alreadybe running
 
       undef $opt{'socketpath'};    # so exit handlers won't unlink it!
@@ -645,6 +648,7 @@
       die "spamd already running on $path, exiting\n";
     }
     else {
+      dbg("spamd: removing stale socket file $path");
       unlink $path;
     }
   }
@@ -1595,7 +1599,7 @@
 
 sub handle_user_ldap {
   my $username = shift;
-  dbg("handle_user_ldap($username)");
+  dbg("spamd: enetring handle_user_ldap($username)");
   $spamtest->load_scoreonly_ldap($username);
   $spamtest->signal_user_changed(
     {
@@ -1929,7 +1933,7 @@
   # Now we can redirect the errors, too.
   open STDERR, '>&STDOUT' or die "Can't duplicate stdout: $!\n";
 
-  Mail::SpamAssassin::dbg('daemonized.');
+  dbg('spamd: daemonized.');
 }
 
 sub set_allowed_ip {
@@ -1960,7 +1964,7 @@
 
   my $tmpsadir = File::Spec->catdir( $tmphome, ".spamassassin" );
 
-  Mail::SpamAssassin::dbg("Preloading modules with HOME=$tmphome");
+  dbg("spamd: Preloading modules with HOME=$tmphome");
 
   mkdir( $tmphome,  0700 ) or die "fatal: Can't create $tmphome: $!";
   mkdir( $tmpsadir, 0700 ) or die "fatal: Can't create $tmpsadir: $!";