2004-11-21 12:01:45 -05:00
|
|
|
$OpenBSD: patch-cgi-bin_openwebmail_openwebmail_pl,v 1.9 2004/11/21 17:01:46 naddy Exp $
|
|
|
|
--- cgi-bin/openwebmail/openwebmail.pl.orig Fri Nov 12 10:37:38 2004
|
|
|
|
+++ cgi-bin/openwebmail/openwebmail.pl Fri Nov 12 14:11:33 2004
|
2003-01-30 02:57:22 -05:00
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
-#!/usr/bin/suidperl -T
|
2003-07-16 06:32:07 -04:00
|
|
|
+#!/usr/bin/perl
|
2003-01-30 02:57:22 -05:00
|
|
|
#################################################################
|
|
|
|
# #
|
|
|
|
# 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);
|
2004-03-04 01:34:09 -05:00
|
|
|
if ( $0 =~ m!^(\S*)/[\w\d\-\.]+\.pl! ) { $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')) {
|
2004-03-04 01:34:09 -05:00
|
|
|
$_=<F>; close(F); if ( $_=~/^(\S*)/) { $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
|
2004-07-12 01:54:51 -04:00
|
|
|
@@ -63,8 +63,8 @@
|
2003-11-13 00:55:50 -05:00
|
|
|
$SIG{PIPE}=\&openwebmail_exit; # for user stop
|
2003-07-16 06:32:07 -04:00
|
|
|
$SIG{TERM}=\&openwebmail_exit; # for user stop
|
2003-01-30 02:57:22 -05:00
|
|
|
|
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-01-30 02:57:22 -05:00
|
|
|
|
2003-07-16 06:32:07 -04:00
|
|
|
# check & create mapping table for solar/lunar, b2g, g2b convertion
|
2004-07-20 20:26:11 -04:00
|
|
|
@@ -77,7 +77,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
|
2004-11-21 12:01:45 -05:00
|
|
|
@@ -251,7 +251,7 @@
|
2004-07-20 20:26:11 -04:00
|
|
|
|
|
|
|
# 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
|
2004-11-21 12:01:45 -05:00
|
|
|
@@ -322,7 +322,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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -383,7 +383,7 @@
|
|
|
|
|
|
|
|
umask(0077);
|
|
|
|
if ( $>==0 ) { # switch to uuid:mailgid if script is setuid root.
|
|
|
|
- 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!");
|
|
|
|
@@ -595,7 +595,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'));
|