79 lines
3.7 KiB
Plaintext
79 lines
3.7 KiB
Plaintext
$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
|
|
+#!/usr/bin/perl
|
|
#################################################################
|
|
# #
|
|
# Open WebMail - Provides a web interface to user mailboxes #
|
|
@@ -18,10 +18,10 @@
|
|
#
|
|
use vars qw($SCRIPT_DIR);
|
|
if ( $0 =~ m!^(\S*)/[\w\d\-\.]+\.pl! ) { local $1; $SCRIPT_DIR=$1 }
|
|
-if ($SCRIPT_DIR eq '' && open(F, '/etc/openwebmail_path.conf')) {
|
|
+if ($SCRIPT_DIR eq '' && open(F, '%%SYSCONFDIR%%/openwebmail/openwebmail_path.conf')) {
|
|
$_=<F>; close(F); if ( $_=~/^(\S*)/) { local $1; $SCRIPT_DIR=$1 }
|
|
}
|
|
-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; }
|
|
push (@INC, $SCRIPT_DIR);
|
|
|
|
foreach (qw(ENV BASH_ENV CDPATH IFS TERM)) {delete $ENV{$_}}; $ENV{PATH}='/bin:/usr/bin'; # secure ENV
|
|
@@ -80,8 +80,8 @@
|
|
########## MAIN ##################################################
|
|
openwebmail_requestbegin();
|
|
|
|
-load_owconf(\%config_raw, "$SCRIPT_DIR/etc/defaults/openwebmail.conf");
|
|
-read_owconf(\%config, \%config_raw, "$SCRIPT_DIR/etc/openwebmail.conf") if (-f "$SCRIPT_DIR/etc/openwebmail.conf");
|
|
+load_owconf(\%config_raw, "%%SYSCONFDIR%%/openwebmail/defaults/openwebmail.conf");
|
|
+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
|
|
|
|
# check & create mapping table for solar/lunar, b2g, g2b convertion
|
|
@@ -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
|
|
@@ -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
|
|
@@ -363,7 +363,7 @@
|
|
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'));
|
|
@@ -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!");
|