You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2014/10/13 23:38:47 UTC

[Bug 7090] Request Option to set path in sa-compile

https://issues.apache.org/SpamAssassin/show_bug.cgi?id=7090

DStaal@usa.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |DStaal@usa.net

--- Comment #1 from DStaal@usa.net ---
Here's a patch that would do what I'm asking for:

-----------------------------------------------------------------
@@ -83,6 +83,7 @@
   'keep-tmps'          => \$opt{'keep-tmps'},

   'configpath|config-file|config-dir|c|C=s' => \$opt{'configpath'},
+  'binpath|bin=s'                           => \$opt{'binpath'},
   'prefspath|prefs-file|p=s'                => \$opt{'prefspath'},
   'siteconfigpath=s'                        => \$opt{'siteconfigpath'},
   'updatedir=s'                             => \$opt{'updatedir'},
@@ -102,6 +103,17 @@
   exit 0;
 }

+# Set up binpath addition.
+if ( !defined $opt{'binpath'} ) {
+  $opt{'binpath'} = '';
+}
+else {
+  no re 'taint';
+  $opt{'binpath'} =~ m|^(/[[[:alpha:]/]+)|;
+  $opt{'binpath'} = $1;
+}
+local $ENV{PATH} = "$ENV{PATH}:$opt{'binpath'}";  # Has to be top-level; the
calls to re2c are.
+
 # Check for some dependencies and provide useful error messages if they aren't
 # present
 eval("use ExtUtils::MakeMaker");
-----------------------------------------------------------------


Note that there is still the possibility of the path being considered 'tainted'
in this: Each directory in the PATH must be absolute and only writable by their
owner.  (See perlsec.)  My untainting regex prevents relative paths, but not
random directories.  The original PATH is also not superseded.  (I also haven't
*documented* the option - I can write that as well if needed.)

-- 
You are receiving this mail because:
You are the assignee for the bug.