pkgsrc/mail/majordomo/patches/patch-af
spz a781a1b538 stop majordomo from chowning /var/tmp to user majordom due to a superannuated
default in mk/defaults/mk.conf

remove the non-shared defaults and put in the setting that actually gets
used by more than one package (namely, MAJORDOMO_HOMEDIR)

don't make the majordom user own more than it actually needs to

make resend, archive, request-answer and medit honor the MAJORDOMO_CF
environment variable over the command line option, so that someone calling
these via the wrapper (which sets the environment variable) can't make
the majordom user execute random perl code by specifying it as config file.
Thanks to salo for finding this issue.
2011-01-29 17:16:32 +00:00

47 lines
1.6 KiB
Text

$NetBSD: patch-af,v 1.5 2011/01/29 17:16:33 spz Exp $
--- majordomo.orig 2000-01-13 17:29:31.000000000 +0000
+++ majordomo
@@ -24,8 +24,11 @@
# The mj_ prefix is reserved for tools that are part of majordomo proper.
$main'program_name = 'mj_majordomo';#';
-# Read and execute the .cf file
-$cf = $ENV{"MAJORDOMO_CF"} || "/etc/majordomo.cf";
+# Read and execute the .cf file. for security reasons, make the env value win
+# (the wrapper will set the env value and setuid to majordomo. If you want
+# to test a config and are properly authorized, su to the majordomo user
+# and don't use the wrapper
+$cf = "/etc/majordomo.cf";
while ($ARGV[0]) { # parse for config file or default list
if ($ARGV[0] =~ /^-C$/i) { # sendmail v8 clobbers case
@@ -40,6 +43,11 @@ while ($ARGV[0]) { # parse for config fi
die "Unknown argument $ARGV[0]\n";
}
}
+
+if ($ENV{"MAJORDOMO_CF"}) {
+ $cf = $ENV{"MAJORDOMO_CF"};
+}
+
if (! -r $cf) {
die("$cf not readable; stopped");
}
@@ -58,6 +66,7 @@ if (! -t STDERR) {
print STDERR "$0: starting\n" if $DEBUG;
# All these should be in the standard PERL library
+unshift(@INC, $bindir);
unshift(@INC, $homedir);
require "ctime.pl"; # To get MoY definitions for month abbrevs
require "majordomo_version.pl"; # What version of Majordomo is this?
@@ -1095,7 +1104,7 @@ sub do_mkdigest {
# The password is valid, so run digest
open(DIGEST,
- "$homedir/digest -m -C -l $list $list_outgoing 2>&1 |");
+ "$bindir/digest -m -C -l $list $list_outgoing 2>&1 |");
@digest_errors = <DIGEST>;
close(DIGEST);