summaryrefslogtreecommitdiff
path: root/mail/majordomo/patches/patch-af
blob: 82c7db98d20f900f926ca50034e3d321b3b303d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-af,v 1.6 2011/01/29 19:39:14 spz Exp $

avoid the wrapper + -C trap

--- 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);