You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2007/06/26 22:13:14 UTC

svn commit: r550927 - in /spamassassin/trunk/t: SATest.pm spamd_plugin.t

Author: sidney
Date: Tue Jun 26 13:13:14 2007
New Revision: 550927

URL: http://svn.apache.org/viewvc?view=rev&rev=550927
Log:
bug 5529: Some tests do not run under root when root's home directory is not world-readable

Modified:
    spamassassin/trunk/t/SATest.pm
    spamassassin/trunk/t/spamd_plugin.t

Modified: spamassassin/trunk/t/SATest.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/SATest.pm?view=diff&rev=550927&r1=550926&r2=550927
==============================================================================
--- spamassassin/trunk/t/SATest.pm (original)
+++ spamassassin/trunk/t/SATest.pm Tue Jun 26 13:13:14 2007
@@ -19,6 +19,7 @@
   our $NO_SPAMC_EXE;
   our $SKIP_SPAMC_TESTS;
   our $SSL_AVAILABLE;
+  our $SKIP_SETUID_NOBODY_TESTS = 0;
 
 }
 
@@ -91,6 +92,11 @@
   # if running as root, ensure "nobody" can write to it too
   if ($> == 0) {
     $tmp_dir_mode = 0777;
+    umask 022;  # ensure correct permissions on files and dirs created here
+    # Bug 5529 initial fix: For now don't run a test as root if it has a problem resuting from setuid nobody
+    # FIXME: Eventually we can actually test setuid nobody and accessing ./log to make this test more fine grained
+    #  and we can create an accessible temp dir that some of the tests can use. But for now just skip those tests.
+    $SKIP_SETUID_NOBODY_TESTS = 1;
   } else {
     $tmp_dir_mode = 0755;
   }
@@ -110,6 +116,7 @@
   # rmtree ("log");
 
   mkdir ("log", 0755);
+  chmod (0755, "log"); # set in case log already exists with wrong permissions
 
   rmtree ("log/user_state");
   rmtree ("log/outputdir.tmp");

Modified: spamassassin/trunk/t/spamd_plugin.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_plugin.t?view=diff&rev=550927&r1=550926&r2=550927
==============================================================================
--- spamassassin/trunk/t/spamd_plugin.t (original)
+++ spamassassin/trunk/t/spamd_plugin.t Tue Jun 26 13:13:14 2007
@@ -4,10 +4,10 @@
 use SATest; sa_t_init("spamd_plugin");
 
 use constant numtests => 6;
-use Test; BEGIN { plan tests => ((!$SKIP_SPAMD_TESTS && !$RUNNING_ON_WINDOWS) ?
-                        numtests : 0) };
+use Test; plan tests => (($SKIP_SPAMD_TESTS || $RUNNING_ON_WINDOWS || $SKIP_SETUID_NOBODY_TESTS) ?
+                        0 : numtests);
 
-exit unless (!$SKIP_SPAMD_TESTS && !$RUNNING_ON_WINDOWS);
+exit unless !($SKIP_SPAMD_TESTS || $RUNNING_ON_WINDOWS || $SKIP_SETUID_NOBODY_TESTS);
 
 # ---------------------------------------------------------------------------