Skip to content

Instantly share code, notes, and snippets.

@holishing
Created November 8, 2019 12:45
Show Gist options
  • Save holishing/bb40d3bcb51ac5be8d2c4559dd7b05c5 to your computer and use it in GitHub Desktop.
Save holishing/bb40d3bcb51ac5be8d2c4559dd7b05c5 to your computer and use it in GitHub Desktop.
OpenWebMail 2.53 to 2.54 diff
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/etc/defaults/openwebmail.conf b/openwebmail-2.54/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
index 38ba0eb..4f43956 100644
--- a/openwebmail-2.53/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
+++ b/openwebmail-2.54/cgi-bin/openwebmail/etc/defaults/openwebmail.conf
@@ -16,11 +16,11 @@
#
name OpenWebMail
-version 2.53
+version 2.54
# these properties are updated automatically during a build for release
# see misc/mkrelease/mkcurrent.sh for more information
-releasedate 20080123
+releasedate 20141206
revision $Rev: $
##############################################################################
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/etc/openwebmail.conf b/openwebmail-2.54/cgi-bin/openwebmail/etc/openwebmail.conf
index 8b448c2..3c91aae 100644
--- a/openwebmail-2.53/cgi-bin/openwebmail/etc/openwebmail.conf
+++ b/openwebmail-2.54/cgi-bin/openwebmail/etc/openwebmail.conf
@@ -10,14 +10,14 @@
#
# Please refer to openwebmail.conf.help for the description of each option
#
-domainnames auto
-auth_module auth_unix.pl
-mailspooldir /var/mail
-ow_cgidir /usr/local/www/cgi-bin/openwebmail
-ow_cgiurl /cgi-bin/openwebmail
-ow_htmldir /usr/local/www/data/openwebmail
-ow_htmlurl /openwebmail
-logfile /var/log/openwebmail.log
+domainnames auto
+auth_module auth_unix.pl
+mailspooldir /var/spool/mail
+ow_cgidir /var/www/cgi-bin/openwebmail
+ow_cgiurl /cgi-bin/openwebmail
+ow_htmldir /var/www/data/openwebmail
+ow_htmlurl /data/openwebmail
+logfile /var/log/openwebmail.log
enable_viruscheck no
enable_spamcheck no
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-abook.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-abook.pl
index 557ae41..cb40b81 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-abook.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-abook.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-abook.pl - address book program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-advsearch.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-advsearch.pl
index 35d0181..a6c00c7 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-advsearch.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-advsearch.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-adsearch.pl - advanced search program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-cal.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-cal.pl
index 0feec42..7bc1719 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-cal.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-cal.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-cal.pl - calendar program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-folder.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-folder.pl
index 27c802e..e8b8439 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-folder.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-folder.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-folder.pl - mail folder management program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-main.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-main.pl
index ea8b681..c054b34 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-main.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-main.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-main.pl - message list browsing program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-prefs.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-prefs.pl
index 4400204..3800591 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-prefs.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-prefs.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-prefs.pl - preference configuration, book editing program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-read.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-read.pl
index 66c72ee..721bf64 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-read.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-read.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-read.pl - message reading program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-saprefs.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-saprefs.pl
index 280d806..37399f5 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-saprefs.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-saprefs.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-saprefs.pl - spamassassin user_prefs file config
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-send.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-send.pl
index 9383104..7ae6df5 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-send.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-send.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-send.pl - mail composing and sending program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-spell.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-spell.pl
index ec10210..e763a08 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-spell.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-spell.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-spell.pl - spell check program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-tool.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-tool.pl
index ffdff66..daea9fe 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-tool.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-tool.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-tool.pl - command tool for mail/event/notify/index...
#
@@ -27,6 +27,7 @@ umask(0002); # make sure the openwebmail group can write
use strict;
use Fcntl qw(:DEFAULT :flock);
use Net::SMTP;
+use Cwd 'abs_path';
require "modules/dbm.pl";
require "modules/suid.pl";
@@ -307,6 +308,59 @@ sub init {
return $err;
}
+## Run suid perl without suidperl using C wrapper
+# http://www.redantigua.com/apache-suid-perl.html
+ if ($] gt "5.011005") {
+ print qq|The version of Perl on your system ($]) does not support set user id.\n|.
+ qq|Attempting to wrap the openwebmail perl files in a C wrapper to enable set\n|.
+ qq|user id capability...\n\n|;
+
+ my $compiler = -x '/usr/bin/cc' ? '/usr/bin/cc' :
+ -x '/usr/bin/gcc' ? '/usr/bin/gcc' :
+ -x '/usr/local/bin/gcc' ? '/usr/local/bin/gcc' :
+ die "No C compiler found. Please install a C compiler and try again.";
+
+ print " Found C compiler $compiler\n";
+
+ opendir(DIR, $SCRIPT_DIR) or die "Cannot open directory: $SCRIPT_DIR";
+ my @files = grep { -f "$SCRIPT_DIR/$_" && m/^openwebmail.*\.pl$/ } readdir(DIR);
+ closedir(DIR) or die "Cannot close directory: $SCRIPT_DIR";
+
+ chdir($SCRIPT_DIR) or die "Cannot change directory to: $SCRIPT_DIR";
+
+ foreach my $file (@files) {
+ $file = ow::tool::untaint($file);
+ print " wrapping file: $file...";
+
+ if (-f ".$file") {
+ print "wrapped file already exists, skipping\n";
+ next;
+ }
+
+ my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,$blksize,$blocks) = stat($file);
+ chmod $mode & 01777, $file; # wipe out set[ug]id bits
+ rename($file, ".$file") or die "Cannot rename file: $file -> .$file";
+ open(C,">.tmp$$.c") || die "Cannot open file: .tmp$$.c";
+ print C '
+ main(argc,argv)
+ int argc;
+ char **argv;
+ {
+ execv("' . abs_path(".$file") . '",argv);
+ }
+ ' . "\n";
+ close C;
+ system($compiler, ".tmp$$.c", '-o', $file);
+ die "Compile error for .tmp$$.c: $?" if $?;
+ chmod $mode, $file;
+ chown $uid, $gid, $file;
+ unlink ".tmp$$.c";
+ print "done\n";
+ }
+
+ print "\n";
+ }
+
foreach my $table ('b2g', 'g2b', 'lunar') {
if ( $config{$table.'_map'} ) {
my $tabledb="$config{'ow_mapsdir'}/$table";
@@ -351,7 +405,7 @@ sub init {
my $id = $ENV{'USER'} || $ENV{'LOGNAME'} || getlogin || (getpwuid($>))[0];
my $hostname=ow::tool::hostname();
my $realname=(getpwnam($id))[6]||$id;
- my $to="stats\@openwebmail.acatysmoof.com";
+ my $to="tchung\@openwebmail.org";
my $date = ow::datetime::dateserial2datefield(ow::datetime::gmtime2dateserial(), $config{'default_timeoffset'}, $prefs{'daylightsaving'}, $prefs{'timezone'});
my $subject="site report - $hostname";
my $os;
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-vdomain.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-vdomain.pl
index 861787e..5b742dc 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-vdomain.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-vdomain.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-vdomain.pl - virtual domain user management
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-viewatt.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-viewatt.pl
index 38c25d3..299581d 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-viewatt.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-viewatt.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-viewatt.pl - attachment reading program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-webdisk.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-webdisk.pl
index ca48e93..72825f9 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail-webdisk.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail-webdisk.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#
# openwebmail-webdisk.pl - web disk program
#
diff --git a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail.pl b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail.pl
index 4f69a4d..c9d0ee4 100755
--- a/openwebmail-2.53/cgi-bin/openwebmail/openwebmail.pl
+++ b/openwebmail-2.54/cgi-bin/openwebmail/openwebmail.pl
@@ -1,4 +1,4 @@
-#!/usr/bin/suidperl -T
+#!/usr/bin/perl -T
#################################################################
# #
# OpenWebMail - Provides a web interface to user mailboxes #
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment