openbsd-ports/mail/openwebmail/patches/patch-cgi-bin_openwebmail_openwebmail_pl

79 lines
3.7 KiB
Plaintext
Raw Normal View History

2005-02-28 22:52:45 -05:00
$OpenBSD: patch-cgi-bin_openwebmail_openwebmail_pl,v 1.11 2005/03/01 03:52:45 kevlo Exp $
--- cgi-bin/openwebmail/openwebmail.pl.orig Mon Feb 28 08:58:27 2005
+++ cgi-bin/openwebmail/openwebmail.pl Tue Mar 1 10:56:06 2005
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
2003-07-16 06:32:07 -04:00
+#!/usr/bin/perl
#################################################################
# #
# Open WebMail - Provides a web interface to user mailboxes #
2003-07-16 06:32:07 -04:00
@@ -18,10 +18,10 @@
2003-04-14 04:26:11 -04:00
#
use vars qw($SCRIPT_DIR);
2005-01-27 01:01:16 -05:00
if ( $0 =~ m!^(\S*)/[\w\d\-\.]+\.pl! ) { local $1; $SCRIPT_DIR=$1 }
2004-07-12 01:54:51 -04:00
-if ($SCRIPT_DIR eq '' && open(F, '/etc/openwebmail_path.conf')) {
+if ($SCRIPT_DIR eq '' && open(F, '%%SYSCONFDIR%%/openwebmail/openwebmail_path.conf')) {
2005-01-27 01:01:16 -05:00
$_=<F>; close(F); if ( $_=~/^(\S*)/) { local $1; $SCRIPT_DIR=$1 }
2003-04-14 04:26:11 -04:00
}
2004-07-12 01:54:51 -04:00
-if ($SCRIPT_DIR eq '') { print "Content-type: text/html\n\nSCRIPT_DIR not set in /etc/openwebmail_path.conf !\n"; exit 0; }
+if ($SCRIPT_DIR eq '') { print "Content-type: text/html\n\nSCRIPT_DIR not set in %%SYSCONFDIR%%/openwebmail/openwebmail_path.conf !\n"; exit 0; }
2003-07-16 06:32:07 -04:00
push (@INC, $SCRIPT_DIR);
2004-11-21 12:01:45 -05:00
foreach (qw(ENV BASH_ENV CDPATH IFS TERM)) {delete $ENV{$_}}; $ENV{PATH}='/bin:/usr/bin'; # secure ENV
2005-02-28 22:52:45 -05:00
@@ -80,8 +80,8 @@
2005-01-27 01:01:16 -05:00
########## MAIN ##################################################
openwebmail_requestbegin();
2004-11-21 12:01:45 -05:00
-load_owconf(\%config_raw, "$SCRIPT_DIR/etc/defaults/openwebmail.conf");
2004-03-04 01:34:09 -05:00
-read_owconf(\%config, \%config_raw, "$SCRIPT_DIR/etc/openwebmail.conf") if (-f "$SCRIPT_DIR/etc/openwebmail.conf");
2004-11-21 12:01:45 -05:00
+load_owconf(\%config_raw, "%%SYSCONFDIR%%/openwebmail/defaults/openwebmail.conf");
2004-03-04 01:34:09 -05:00
+read_owconf(\%config, \%config_raw, "%%SYSCONFDIR%%/openwebmail/openwebmail.conf") if (-f "%%SYSCONFDIR%%/openwebmail/openwebmail.conf");
loadlang($config{'default_language'}); # so %lang... can be used in error msg
2003-07-16 06:32:07 -04:00
# check & create mapping table for solar/lunar, b2g, g2b convertion
2005-02-28 22:52:45 -05:00
@@ -94,7 +94,7 @@
}
if ($config{'logfile'}) {
- my $mailgid=getgrnam('mail');
+ my $mailgid=getgrnam('_mail');
my ($fmode, $fuid, $fgid) = (stat($config{'logfile'}))[2,4,5];
if ( !($fmode & 0100000) ) {
open (LOGFILE,">>$config{'logfile'}") or
2005-02-28 22:52:45 -05:00
@@ -285,7 +285,7 @@
# create domain logfile
if ($config{'logfile'}) {
- my $mailgid=getgrnam('mail');
+ my $mailgid=getgrnam('_mail');
my ($fmode, $fuid, $fgid) = (stat($config{'logfile'}))[2,4,5];
if ( !($fmode & 0100000) ) {
open (LOGFILE,">>$config{'logfile'}") or
2005-02-28 22:52:45 -05:00
@@ -363,7 +363,7 @@
2004-11-21 12:01:45 -05:00
writelog("login error - $config{'auth_module'}, ret $errorcode, $errormsg");
umask(0077);
if ( $>==0 ) { # switch to uuid:mailgid if script is setuid root.
- my $mailgid=getgrnam('mail');
+ my $mailgid=getgrnam('_mail');
ow::suid::set_euid_egids($uuid, $mailgid, split(/\s+/,$ugid));
}
my $historyfile=ow::tool::untaint(dotpath('history.log'));
2005-02-28 22:52:45 -05:00
@@ -402,7 +402,7 @@
if (!-d $domainhome) {
mkdir($domainhome, 0750);
openwebmailerror(__FILE__, __LINE__, "Couldn't create domain homedir $domainhome") if (! -d $domainhome);
- my $mailgid=getgrnam('mail');
+ my $mailgid=getgrnam('_mail');
chown($uuid, $mailgid, $domainhome);
}
}
@@ -451,7 +451,7 @@
# set umask, switch to uuid:mailgid if script is setuid root.
umask(0077);
if ( $>==0 ) {
- my $mailgid=getgrnam('mail'); # for better compatibility with other mail progs
+ my $mailgid=getgrnam('_mail'); # for better compatibility with other mail progs
ow::suid::set_euid_egids($uuid, $mailgid, split(/\s+/,$ugid));
if ( $)!~/\b$mailgid\b/) { # group mail doesn't exist?
openwebmailerror(__FILE__, __LINE__, "Set effective gid to mail($mailgid) failed!");