Skip to content

Instantly share code, notes, and snippets.

@holishing
Created November 8, 2019 13:17
Show Gist options
  • Save holishing/0a785f02ed51c4291b478c1a6f353f52 to your computer and use it in GitHub Desktop.
Save holishing/0a785f02ed51c4291b478c1a6f353f52 to your computer and use it in GitHub Desktop.
OpenWebMail rpm package el7 2.54-2 to el8 2.54-3 diff
diff --git a/2543/el8_getmessage.pl.patch b/2543/el8_getmessage.pl.patch
new file mode 100644
index 0000000..995b867
--- /dev/null
+++ b/2543/el8_getmessage.pl.patch
@@ -0,0 +1,11 @@
+--- cgi-bin/openwebmail/shares/getmessage.pl 2007-08-10 09:35:42.000000000 -0700
++++ cgi-bin/openwebmail/shares/getmessage.pl.el8 2019-11-05 23:52:38.096207843 -0800
+@@ -89,7 +89,7 @@
+ $message{status} =~ s/\s//g;
+ if ($message{'content-type'}=~/charset="?([^\s"';]*)"?\s?/i) {
+ $message{charset}=$1;
+- } elsif (defined @{$message{attachment}}) {
++ } elsif (defined {$message{attachment}}) {
+ my @att=@{$message{attachment}};
+ foreach my $i (0 .. $#att) {
+ if (defined ${$att[$i]}{charset} && ${$att[$i]}{charset} ne '') {
diff --git a/2543/el8_mailfilter.pl.patch b/2543/el8_mailfilter.pl.patch
new file mode 100644
index 0000000..5f7244b
--- /dev/null
+++ b/2543/el8_mailfilter.pl.patch
@@ -0,0 +1,109 @@
+--- cgi-bin/openwebmail/shares/mailfilter.pl 2006-05-12 21:21:23.000000000 -0700
++++ cgi-bin/openwebmail/shares/mailfilter.pl.el8 2019-11-05 23:10:00.507064865 -0800
+@@ -7,7 +7,7 @@
+ # There are 4 types of checks in this mail filter
+ #
+ # 1. external viruscheck (clamav)
+-# 2. static global and user defined rules
++# 2. static global and user rules
+ # 3. external spamcheck (spamassassin)
+ # 4. smart filter rules
+ #
+@@ -20,9 +20,9 @@
+
+ # extern vars
+ use vars qw($_OFFSET $_SIZE $_HEADERSIZE $_HEADERCHKSUM $_RECVDATE $_DATE
+- $_FROM $_TO $_SUBJECT $_CONTENT_TYPE $_CHARSET $_STATUS $_REFERENCES); # defined in maildb.pl
++ $_FROM $_TO $_SUBJECT $_CONTENT_TYPE $_CHARSET $_STATUS $_REFERENCES); # in maildb.pl
+ use vars qw(%config %lang_err);
+-use vars qw(%op_order %ruletype_order %folder_order); # table defined in filterbook.pl
++use vars qw(%op_order %ruletype_order %folder_order); # table in filterbook.pl
+
+ ########## FILTERMESSAGE #########################################
+ # filter inbox messages in background
+@@ -312,7 +312,7 @@
+ my $is_matched=0;
+
+ # precompile text into regex of msg charset for speed
+- if (!defined ${$r_rule}{'regex.'.$attr[$_CHARSET]}) {
++ if (! ${$r_rule}{'regex.'.$attr[$_CHARSET]}) {
+ my $text=(iconv(${$r_rule}{charset}, $attr[$_CHARSET], ${$r_rule}{text}))[0];
+ if (${$r_prefs}{'regexmatch'} && ow::tool::is_regex($text)) { # do regex compare?
+ ${$r_rule}{'regex.'.$attr[$_CHARSET]}=qr/$text/im;
+@@ -326,7 +326,7 @@
+ $decoded_header=decode_mimewords_iconv($header, $attr[$_CHARSET]);
+ $decoded_header=~s/\s*\n\s+/ /sg; # concate folding lines
+ }
+- if (!defined $msg{from}) { # this is defined after parse_header is called
++ if (! $msg{from}) { # this is after parse_header is called
+ ow::mailparse::parse_header(\$decoded_header, \%msg);
+ }
+ if ($msg{${$r_rule}{type}}=~/${$r_rule}{'regex.'.$attr[$_CHARSET]}/
+@@ -345,7 +345,7 @@
+ }
+
+ } elsif ( ${$r_rule}{type} eq 'smtprelay' ) {
+- if (!defined $r_smtprelays) {
++ if (! $r_smtprelays) {
+ ($r_smtprelays, $r_connectfrom, $r_byas)=ow::mailparse::get_smtprelays_connectfrom_byas_from_header($header);
+ }
+ my $smtprelays;
+@@ -366,7 +366,7 @@
+ $io_errcount++; $i--; next;
+ }
+ }
+- if (!defined @{$r_attachments}) {
++ if (! @{$r_attachments}) {
+ ($header, $body, $r_attachments)=ow::mailparse::parse_rfc822block(\$currmessage);
+ }
+
+@@ -430,7 +430,7 @@
+ $io_errcount++; $i--; next;
+ }
+ }
+- if (!defined @{$r_attachments}) {
++ if (! @{$r_attachments}) {
+ ($header, $body, $r_attachments)=ow::mailparse::parse_rfc822block(\$currmessage);
+ }
+ # check attachments
+@@ -447,7 +447,7 @@
+ # cp msg to other folder and set reserved_in_folder or to_be_moved flag
+ filterruledb_increase($key, 1);
+
+- if (!defined ${$r_rule}{fsdest}) {
++ if (! ${$r_rule}{fsdest}) {
+ ${$r_rule}{fsdest}=(iconv(${$r_rule}{charset}, ${$r_prefs}{fscharset}, ${$r_rule}{dest}))[0];
+ }
+
+@@ -596,11 +596,11 @@
+ # filter message from smtprelay with faked name if msg is not moved or deleted
+ if ( ${$r_prefs}{'filter_fakedsmtp'} &&
+ !$reserved_in_folder && !$to_be_moved ) {
+- if (!defined $r_smtprelays) {
++ if (! $r_smtprelays) {
+ ($r_smtprelays, $r_connectfrom, $r_byas)=ow::mailparse::get_smtprelays_connectfrom_byas_from_header($header);
+ }
+ # move msg to trash if the first relay has invalid/faked hostname
+- if (defined ${$r_smtprelays}[0]) {
++ if ( ${$r_smtprelays}[0]) {
+ my $relay=${$r_smtprelays}[0];
+ my $connectfrom=${$r_connectfrom}{$relay};
+ my $byas=${$r_byas}{$relay};
+@@ -638,7 +638,7 @@
+ $io_errcount++; $i--; next;
+ }
+ }
+- if (!defined @{$r_attachments}) {
++ if (! @{$r_attachments}) {
+ ($header, $body, $r_attachments)=ow::mailparse::parse_rfc822block(\$currmessage);
+ }
+
+@@ -694,7 +694,7 @@
+ ow::datetime::dateserial2gmtime($attr[$_DATE]) >= $repeatstarttime) {
+ # store msgid with same '$from:$subject' to same array
+ my $msgstr="$attr[$_FROM]:$attr[$_SUBJECT]";
+- if (!defined $repeatlists{$msgstr}) {
++ if (! $repeatlists{$msgstr}) {
+ $repeatlists{$msgstr}=[]; # reference of null array
+ }
+ push (@{$repeatlists{$msgstr}}, $messageid_i);
diff --git a/2543/el8_openwebmail-send.pl.patch b/2543/el8_openwebmail-send.pl.patch
new file mode 100644
index 0000000..a326bce
--- /dev/null
+++ b/2543/el8_openwebmail-send.pl.patch
@@ -0,0 +1,326 @@
+--- cgi-bin/openwebmail/openwebmail-send.pl 2014-12-06 18:28:46.000000000 -0800
++++ cgi-bin/openwebmail/openwebmail-send.pl.el8 2019-11-05 23:43:24.198440674 -0800
+@@ -57,10 +57,10 @@
+
+ # extern vars
+ use vars qw(%lang_folders %lang_sizes %lang_wdbutton %lang_text %lang_err
+- %lang_prioritylabels %lang_msgformatlabels); # defined in lang/xy
+-use vars qw(%charset_convlist); # defined in iconv.pl
++ %lang_prioritylabels %lang_msgformatlabels); # in lang/xy
++use vars qw(%charset_convlist); # in iconv.pl
+ use vars qw($_OFFSET $_SIZE $_HEADERSIZE $_HEADERCHKSUM $_RECVDATE $_DATE
+- $_FROM $_TO $_SUBJECT $_CONTENT_TYPE $_STATUS $_CHARSET $_REFERENCES); # defined in maildb.pl
++ $_FROM $_TO $_SUBJECT $_CONTENT_TYPE $_STATUS $_CHARSET $_REFERENCES); # in maildb.pl
+
+ # local globals
+ use vars qw($folder $messageid $mymessageid);
+@@ -328,7 +328,7 @@
+ }
+
+ my %userfrom=get_userfrom($logindomain, $loginuser, $user, $userrealname, dotpath('from.book'));
+- if (defined param('from')) {
++ if ( param('from')) {
+ $from=param('from')||'';
+ } elsif ($userfrom{$prefs{'email'}} ne "") {
+ $from=qq|"$userfrom{$prefs{'email'}}" <$prefs{'email'}>|;
+@@ -367,7 +367,7 @@
+ }
+ ($attfiles_totalsize, $r_attfiles) = getattfilesinfo();
+
+- } elsif (defined param('addbutton') || # user press 'add' button
++ } elsif ( param('addbutton') || # user press 'add' button
+ param('webdisksel') ) { # file selected from webdisk
+ ($attfiles_totalsize, $r_attfiles) = getattfilesinfo();
+
+@@ -411,7 +411,7 @@
+ $attname =~ s|^.*/||; # unix path
+ $attname =~ s|^.*:||; # mac path and dos drive
+
+- if (defined uploadInfo($attachment)) {
++ if ( uploadInfo($attachment)) {
+ # my %info=%{uploadInfo($attachment)};
+ $attcontenttype = ${uploadInfo($attachment)}{'Content-Type'} || 'application/octet-stream';
+ } else {
+@@ -468,7 +468,7 @@
+ }
+
+ # usr press 'send' button but no receiver, keep editing
+- } elsif (defined param('sendbutton') &&
++ } elsif ( param('sendbutton') &&
+ param('to') eq '' && param('cc') eq '' && param('bcc') eq '' ) {
+ ($attfiles_totalsize, $r_attfiles) = getattfilesinfo();
+
+@@ -502,7 +502,7 @@
+ # handle the messages generated if sendmail is set up to send MIME error reports
+ if ($message{'content-type'} =~ /^multipart\/report/i) {
+ foreach my $attnumber (0 .. $#{$message{attachment}}) {
+- if (defined ${${$message{attachment}[$attnumber]}{r_content}}) {
++ if ( ${${$message{attachment}[$attnumber]}{r_content}}) {
+ $body .= ${${$message{attachment}[$attnumber]}{r_content}};
+ shift @{$message{attachment}};
+ }
+@@ -510,7 +510,7 @@
+ } elsif ($message{'content-type'} =~ /^multipart/i) {
+ # If the first attachment is text,
+ # assume it's the body of a message in multi-part format
+- if ( defined %{$message{attachment}[0]} &&
++ if ( %{$message{attachment}[0]} &&
+ ${$message{attachment}[0]}{'content-type'} =~ /^text/i ) {
+ if (${$message{attachment}[0]}{'content-transfer-encoding'} =~ /^quoted-printable/i) {
+ $body = decode_qp(${${$message{attachment}[0]}{r_content}});
+@@ -531,7 +531,7 @@
+ # handle mail with both text and html version
+ # rename html to other name so if user in text compose mode,
+ # the modified/forwarded text won't be overridden by html again
+- if ( defined %{$message{attachment}[1]} &&
++ if ( %{$message{attachment}[1]} &&
+ ${$message{attachment}[1]}{boundary} eq ${$message{attachment}[0]}{boundary} ) {
+ # rename html attachment in the same alternative group
+ if ( (${$message{attachment}[0]}{subtype}=~/alternative/i &&
+@@ -593,13 +593,13 @@
+ # carry attachments from old mesage to the new one
+ if ($composetype eq "forward" || $composetype eq "forwardasorig" ||
+ $composetype eq "editdraft") {
+- if (defined ${$message{attachment}[0]}{header}) {
++ if ( ${$message{attachment}[0]}{header}) {
+ my $attserial=time(); $attserial=ow::tool::untaint($attserial);
+ foreach my $attnumber (0 .. $#{$message{attachment}}) {
+ my $r_attachment=$message{attachment}[$attnumber];
+ $attserial++;
+ if (${$r_attachment}{header} ne "" &&
+- defined ${$r_attachment}{r_content}) {
++ ${$r_attachment}{r_content}) {
+ my ($attheader, $r_content)=(${$r_attachment}{header}, ${$r_attachment}{r_content});
+
+ if (${$r_attachment}{'content-type'}=~/^application\/ms\-tnef/i) {
+@@ -632,7 +632,7 @@
+ $msgformat='both' if ($msgformat eq 'html');
+
+ my $showhtmlastext=$prefs{'showhtmlastext'};
+- $showhtmlastext=param('showhtmlastext') if (defined param('showhtmlastext'));
++ $showhtmlastext=param('showhtmlastext') if ( param('showhtmlastext'));
+ $msgformat='text' if ($showhtmlastext);
+ }
+
+@@ -664,7 +664,7 @@
+ if ($composetype eq "reply" || $composetype eq "replyall") {
+ $subject = $message{'subject'} || '';
+ $subject = "Re: " . $subject unless ($subject =~ /^re:/i);
+- if (defined $message{'reply-to'} && $message{'reply-to'}=~/[^\s]/) {
++ if ( $message{'reply-to'} && $message{'reply-to'}=~/[^\s]/) {
+ $to = $message{'reply-to'} || '';
+ } else {
+ $to = $message{'from'} || '';
+@@ -743,11 +743,11 @@
+ }
+ ($subject, $to, $cc)=iconv('utf-8',$composecharset,$subject,$to,$cc);
+
+- if (defined $prefs{'autocc'} && $prefs{'autocc'} ne '') {
++ if ( $prefs{'autocc'} && $prefs{'autocc'} ne '') {
+ $cc .= ', ' if ($cc ne '');
+ $cc .= (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0];
+ }
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if (defined $prefs{'replyto'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ( $prefs{'replyto'});
+ $inreplyto = $message{'message-id'};
+ if ($message{'references'} =~ /\S/) {
+ $references = $message{'references'}." ".$message{'message-id'};
+@@ -815,8 +815,8 @@
+ $body .= $n.$n;
+ $body .= str2str((iconv($prefs{'charset'}, $composecharset, $prefs{'signature'}))[0], $msgformat).$n if ($prefs{'signature'}=~/[^\s]/);
+
+- $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if (defined $prefs{'autocc'});
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if (defined $prefs{'replyto'});
++ $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if ( $prefs{'autocc'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ( $prefs{'replyto'});
+ $inreplyto = $message{'message-id'};
+ if ($message{'references'} =~ /\S/) {
+ $references = $message{'references'}." ".$message{'message-id'};
+@@ -834,9 +834,9 @@
+ ($body)=iconv($convfrom, $composecharset, $body);
+
+ $references = $message{'references'};
+- $priority = $message{'priority'} if (defined $message{'priority'});
++ $priority = $message{'priority'} if ( $message{'priority'});
+
+- $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if (defined $prefs{'autocc'});
++ $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if ( $prefs{'autocc'});
+
+ # remove odds space or blank lines from body
+ if ($msgformat eq 'text') {
+@@ -847,18 +847,18 @@
+
+ } elsif ($composetype eq "editdraft") {
+ $subject = $message{'subject'} || '';
+- $to = $message{'to'} if (defined $message{'to'});
+- $cc = $message{'cc'} if (defined $message{'cc'});
+- $bcc = $message{'bcc'} if (defined $message{'bcc'});
+- $replyto = $message{'reply-to'} if (defined $message{'reply-to'});
++ $to = $message{'to'} if ( $message{'to'});
++ $cc = $message{'cc'} if ( $message{'cc'});
++ $bcc = $message{'bcc'} if ( $message{'bcc'});
++ $replyto = $message{'reply-to'} if ( $message{'reply-to'});
+ ($subject, $to, $cc, $bcc, $replyto)=
+ iconv('utf-8', $composecharset, $subject,$to,$cc,$bcc,$replyto);
+ ($body)= iconv($convfrom, $composecharset, $body);
+
+ $inreplyto = $message{'in-reply-to'};
+ $references = $message{'references'};
+- $priority = $message{'priority'} if (defined $message{'priority'});
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ($replyto eq '' && defined $prefs{'replyto'});
++ $priority = $message{'priority'} if ( $message{'priority'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ($replyto eq '' && $prefs{'replyto'});
+
+ # we prefer to use the messageid in a draft message if available
+ $mymessageid = $messageid if ($messageid);
+@@ -933,8 +933,8 @@
+ } else {
+ $references = $message{'message-id'};
+ }
+- $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if (defined $prefs{'autocc'});
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if (defined $prefs{'replyto'});
++ $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if ( $prefs{'autocc'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ( $prefs{'replyto'});
+
+ my $n="\n"; $n="<br>" if ($msgformat ne 'text');
+ $body = $n."# Message forwarded as attachment".$n.$n;
+@@ -992,8 +992,8 @@
+ ($attfiles_totalsize, $r_attfiles) = getattfilesinfo();
+
+ $subject = "Fw: ";
+- $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if (defined $prefs{'autocc'});
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if (defined $prefs{'replyto'});
++ $cc = (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0] if ( $prefs{'autocc'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ( $prefs{'replyto'});
+
+ my $n="\n"; $n="<br>" if ($msgformat ne 'text');
+ if ($#forwardids>0) {
+@@ -1025,11 +1025,11 @@
+
+ } else { # sendto or newmail
+ $msgformat='text' if ($msgformat eq 'auto');
+- if (defined $prefs{'autocc'} && $prefs{'autocc'} ne '') {
++ if ( $prefs{'autocc'} && $prefs{'autocc'} ne '') {
+ $cc .= ', ' if ($cc ne '');
+ $cc .= (iconv($prefs{'charset'}, $composecharset, $prefs{'autocc'}))[0];
+ }
+- $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if (defined $prefs{'replyto'});
++ $replyto = (iconv($prefs{'charset'}, $composecharset, $prefs{'replyto'}))[0] if ( $prefs{'replyto'});
+
+ my $n="\n"; $n="<br>" if ($msgformat ne 'text');
+ $body.=$n.$n.str2str((iconv($prefs{'charset'}, $composecharset, $prefs{'signature'}))[0], $msgformat).$n if ($prefs{'signature'}=~/[^\s]/);
+@@ -1144,11 +1144,11 @@
+ my @ctlist=('none');
+ my %allsets=();
+ foreach ((map { $ow::lang::charactersets{$_}[1] } keys %ow::lang::charactersets), keys %charset_convlist) {
+- $allsets{$_}=1 if (!defined $allsets{$_});
++ $allsets{$_}=1 if (! $allsets{$_});
+ }
+ delete $allsets{$composecharset};
+
+- if (defined $charset_convlist{$composecharset}) {
++ if ( $charset_convlist{$composecharset}) {
+ foreach my $ct (sort @{$charset_convlist{$composecharset}}) {
+ if (is_convertible($composecharset, $ct)) {
+ $ctlabels{$ct}="$composecharset > $ct";
+@@ -1296,7 +1296,7 @@
+
+ templateblock_enable($html, 'BACKUPSENT');
+ my $backupsent=$prefs{'backupsentmsg'};
+- if (defined param('backupsent')) {
++ if ( param('backupsent')) {
+ $backupsent=param('backupsent')||0;
+ }
+ $temphtml = checkbox(-name=>'backupsentmsg',
+@@ -1548,7 +1548,7 @@
+ qq|//-->\n</script>\n|;
+ }
+ my $session_noupdate=param('session_noupdate')||'';
+- if (defined param('savedraftbutton') && !$session_noupdate) {
++ if ( param('savedraftbutton') && !$session_noupdate) {
+ # savedraft from user clicking, show show some msg for notifitcaiton
+ my $msg=qq|<font size="-1">$lang_text{'draftsaved'}</font>|;
+ $msg=~s/\@\@\@SUBJECT\@\@\@/$subject/;
+@@ -1557,7 +1557,7 @@
+ qq|showmsg('$prefs{charset}', '$lang_text{savedraft}', '$msg', '$lang_text{"close"}', '_savedraft', 300, 100, 5);\n|.
+ qq|//-->\n</script>\n|;
+ }
+- if (defined param('savedraftbutton') && $session_noupdate) {
++ if ( param('savedraftbutton') && $session_noupdate) {
+ # this is auto savedraft triggered by timeoutwarning,
+ # timeoutwarning js code is not required any more
+ httpprint([], [htmlheader(), $html, htmlfooter(2)]);
+@@ -1579,8 +1579,8 @@
+ sub sendmessage {
+ no strict 'refs'; # for $attchment, which is fname and fhandle of the upload
+ # goto composemessage if !savedraft && !send
+- if ( !defined param('savedraftbutton') &&
+- !(defined param('sendbutton') && (param('to')||param('cc')||param('bcc'))) ) {
++ if ( ! param('savedraftbutton') &&
++ !( param('sendbutton') && (param('to')||param('cc')||param('bcc'))) ) {
+ return(composemessage());
+ }
+
+@@ -1630,7 +1630,7 @@
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'att_overlimit'} $config{'attlimit'} $lang_sizes{'kb'}!");
+ }
+ my $attcontenttype;
+- if (defined uploadInfo($attachment)) {
++ if ( uploadInfo($attachment)) {
+ $attcontenttype = ${uploadInfo($attachment)}{'Content-Type'} || 'application/octet-stream';
+ } else {
+ $attcontenttype = 'application/octet-stream';
+@@ -1691,7 +1691,7 @@
+ my $messageheader='';
+ my $folderhandle=do { local *FH };
+
+- if (defined param('savedraftbutton')) { # save msg to draft folder
++ if ( param('savedraftbutton')) { # save msg to draft folder
+ $savefolder = 'saved-drafts';
+ $do_send=0;
+ $do_save=0 if ($quotalimit>0 && $quotausage>=$quotalimit ||
+@@ -1809,7 +1809,7 @@
+ my %FDB;
+ ow::dbm::open(\%FDB, $savedb, LOCK_SH) or
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'couldnt_readlock'} ".f2u($savedb));
+- if (defined $FDB{$mymessageid}) {
++ if ( $FDB{$mymessageid}) {
+ $oldmsgfound=1;
+ $oldsubject=(string2msgattr($FDB{$mymessageid}))[$_SUBJECT];
+ }
+@@ -2291,7 +2291,7 @@
+
+ ow::dbm::open(\%FDB, $folderdb, LOCK_EX) or
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'couldnt_writelock'} ".f2u($folderdb));
+- if (defined $FDB{$inreplyto}) {
++ if ( $FDB{$inreplyto}) {
+ $oldstatus = (string2msgattr($FDB{$inreplyto}))[$_STATUS];
+ $found=1;
+ }
+@@ -2316,7 +2316,7 @@
+ } elsif ($saveerr) {
+ openwebmailerror(__FILE__, __LINE__, $saveerrstr);
+ } else {
+- if (defined param('sendbutton')) {
++ if ( param('sendbutton')) {
+ # delete attachments only if no error,
+ # in case user trys resend, attachments could be available
+ deleteattachments();
+@@ -2416,7 +2416,7 @@
+
+ sysopen(ATTFILE, $attfile, O_RDONLY);
+ # print attheader line by line
+- while (defined($s = <ATTFILE>)) {
++ while (($s = <ATTFILE>)) {
+ if ($s =~ /^Content\-Id: <?att\d\d\d\d\d\d\d\d/ && !$referenced) {
+ # remove contentid from attheader if it was set by openwebmail but not referenced,
+ # since outlook will treat an attachment as invalid
+@@ -2512,7 +2512,7 @@
+
+ ########## FOLDING ###############################################
+ # folding the to, cc, bcc field so it won't violate the 998 char
+-# limit (defined in RFC 2822 2.2.3) after base64/qp encoding
++# limit ( in RFC 2822 2.2.3) after base64/qp encoding
+ # ps: since qp may extend strlen for 3 times, we use 998/3=332 as limit
+ sub folding {
+ return($_[0]) if (length($_[0])<330);
diff --git a/2543/el8_ow-shared.pl.patch b/2543/el8_ow-shared.pl.patch
new file mode 100644
index 0000000..97e6184
--- /dev/null
+++ b/2543/el8_ow-shared.pl.patch
@@ -0,0 +1,360 @@
+--- cgi-bin/openwebmail/shares/ow-shared.pl 2008-01-02 23:49:18.000000000 -0800
++++ cgi-bin/openwebmail/shares/ow-shared.pl.el8 2019-11-05 23:10:48.492912180 -0800
+@@ -5,7 +5,7 @@
+ use strict;
+ use Fcntl qw(:DEFAULT :flock);
+
+-# extern vars, defined in caller openwebmail-xxx.pl
++# extern vars, in caller openwebmail-xxx.pl
+ use vars qw($SCRIPT_DIR);
+ use vars qw($persistence_count);
+ use vars qw(%config %config_raw);
+@@ -14,7 +14,7 @@
+ use vars qw($domain $user $userrealname $uuid $ugid $homedir);
+ use vars qw(%prefs %style %icontext);
+ use vars qw($quotausage $quotalimit);
+-use vars qw(%lang_sizes %lang_text %lang_err); # defined in lang/xy
++use vars qw(%lang_sizes %lang_text %lang_err); # in lang/xy
+
+ # globals constants
+ use vars qw(%is_config_option);
+@@ -184,33 +184,33 @@
+ use vars qw($_vars_used);
+ sub openwebmail_clearall {
+ # clear opentable in filelock.pl
+- ow::filelock::closeall() if (defined %ow::filelock::opentable);
++ ow::filelock::closeall() if ( %ow::filelock::opentable);
+
+ # chdir back to openwebmail cgidir
+ chdir($config{'ow_cgidir'}) if ($config{'ow_cgidir'});
+
+ # clear gobal variable for persistent perl
+- undef(%SIG) if (defined %SIG);
+- undef(%config) if (defined %config);
+- undef(%config_raw) if (defined %config_raw);
+- undef($thissession) if (defined $thissession);
+- undef(%icontext) if (defined %icontext);
+-
+- undef($default_logindomain) if (defined $default_logindomain);
+- undef($loginname) if (defined $loginname);
+- undef($logindomain) if (defined $logindomain);
+- undef($loginuser) if (defined $loginuser);
+-
+- undef($domain) if (defined $domain);
+- undef($user) if (defined $user);
+- undef($userrealname) if (defined $userrealname);
+- undef($uuid) if (defined $uuid);
+- undef($ugid) if (defined $ugid);
+- undef($homedir) if (defined $homedir);
+- undef(%prefs) if (defined %prefs);
++ undef(%SIG) if ( %SIG);
++ undef(%config) if ( %config);
++ undef(%config_raw) if ( %config_raw);
++ undef($thissession) if ( $thissession);
++ undef(%icontext) if ( %icontext);
++
++ undef($default_logindomain) if ( $default_logindomain);
++ undef($loginname) if ( $loginname);
++ undef($logindomain) if ( $logindomain);
++ undef($loginuser) if ( $loginuser);
++
++ undef($domain) if ( $domain);
++ undef($user) if ( $user);
++ undef($userrealname) if ( $userrealname);
++ undef($uuid) if ( $uuid);
++ undef($ugid) if ( $ugid);
++ undef($homedir) if ( $homedir);
++ undef(%prefs) if ( %prefs);
+
+- undef($quotausage) if (defined $quotausage);
+- undef($quotalimit) if (defined $quotalimit);
++ undef($quotausage) if ( $quotausage);
++ undef($quotalimit) if ( $quotalimit);
+ }
+
+ # routine used at CGI request begin
+@@ -260,7 +260,7 @@
+ }
+ }
+
+- if (!defined param('sessionid') ) {
++ if (! param('sessionid') ) {
+ # delayed response for non localhost
+ sleep $config{'loginerrordelay'} if (ow::tool::clientip() ne "127.0.0.1");
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'param_fmterr'}, $lang_err{'access_denied'}");
+@@ -320,7 +320,7 @@
+ ($loginname=~/\@/ || $config{'enable_domainselectmenu'})) {
+ $config{'domainnames'}=[ $logindomain ];
+ }
+- # override realname if defined in config
++ # override realname if in config
+ if ($config{'default_realname'} ne 'auto') {
+ $userrealname=$config{'default_realname'}
+ }
+@@ -396,7 +396,7 @@
+ }
+ $loginuser=lc($loginuser) if ($config{'case_insensitive_login'});
+ $logindomain=lc(safedomainname($logindomain));
+- $logindomain=$config{'domainname_equiv'}{'map'}{$logindomain} if (defined $config{'domainname_equiv'}{'map'}{$logindomain});
++ $logindomain=$config{'domainname_equiv'}{'map'}{$logindomain} if ( $config{'domainname_equiv'}{'map'}{$logindomain});
+ return($logindomain, $loginuser);
+ }
+ ########## END LOGINNAME 2 LOGINDOMAIN LOGINUSER #################
+@@ -412,11 +412,11 @@
+ load_owconf($r_config_raw, $configfile) if ($configfile);
+
+ # make sure there are default values for array/hash references!!
+- if (!defined ${$r_config_raw}{'domainname_equiv'}){
++ if (! ${$r_config_raw}{'domainname_equiv'}){
+ ${$r_config_raw}{'domainname_equiv'}= { 'map'=>{}, 'list'=>{} };
+ }
+ foreach $key (keys %{$is_config_option{'list'}}) {
+- if (!defined ${$r_config_raw}{$key} && $key!~/^DEFAULT_/) {
++ if (! ${$r_config_raw}{$key} && $key!~/^DEFAULT_/) {
+ ${$r_config_raw}{$key}=[];
+ }
+ # NOTE: We don't set defualt value for DEFAULT_ options, or the default_ options will be overriden.
+@@ -468,7 +468,7 @@
+ ${$r_config}{'default_abook_defaultsearchtype'}="name" if ( ${$r_config}{'default_abook_defaultsearchtype'} eq '' );
+ ${$r_config}{'domainselectmenu_list'}=${$r_config}{'domainnames'} if ( ${${$r_config}{'domainselectmenu_list'}}[0] eq 'auto' );
+
+- # untaint pathname variable defined in openwebmail.conf
++ # untaint pathname variable in openwebmail.conf
+ foreach $key ( keys %{$is_config_option{'untaint'}} ) {
+ if ( $is_config_option{'list'}{$key} ) {
+ foreach ( @{${$r_config}{$key}} ) {
+@@ -491,7 +491,7 @@
+ my ($r_config_raw, $configfile)=@_;
+
+ my $t=0; $t=(-M $configfile) if ($configfile!~/openwebmail\.conf\.default$/);
+- if (!defined $_rawconfcache{$configfile}{'t'} ||
++ if (! $_rawconfcache{$configfile}{'t'} ||
+ $_rawconfcache{$configfile}{'t'} ne $t ) {
+ $_rawconfcache{$configfile}{'t'}=$t;
+ $_rawconfcache{$configfile}{'c'}=_load_owconf($configfile);
+@@ -592,7 +592,7 @@
+ ########## MATCHLIST_... #########################################
+ sub matchlist_all {
+ my ($listname)=@_;
+- return 1 if (!defined $config{$listname});
++ return 1 if (! $config{$listname});
+
+ foreach my $token (@{$config{$listname}}) {
+ return 1 if (lc($token) eq 'all');
+@@ -602,7 +602,7 @@
+
+ sub matchlist_exact {
+ my ($listname, $value)=($_[0], lc($_[1]));
+- return 1 if (!defined $config{$listname});
++ return 1 if (! $config{$listname});
+
+ foreach (@{$config{$listname}}) {
+ my $token=lc($_);
+@@ -613,7 +613,7 @@
+
+ sub matchlist_fromhead {
+ my ($listname, $value)=($_[0], lc($_[1]));
+- return 1 if (!defined $config{$listname});
++ return 1 if (! $config{$listname});
+
+ foreach (@{$config{$listname}}) {
+ my $token=lc($_);
+@@ -624,7 +624,7 @@
+
+ sub matchlist_fromtail {
+ my ($listname, $value)=($_[0], lc($_[1]));
+- return 1 if (!defined $config{$listname});
++ return 1 if (! $config{$listname});
+
+ foreach (@{$config{$listname}}) {
+ my $token=lc($_);
+@@ -692,7 +692,7 @@
+ }
+ $prefshash{"signature"}=~s/\s+$/\n/;
+
+- # get default value from config for err/undefined/empty prefs entries
++ # get default value from config for err/un/empty prefs entries
+
+ # validate email with defaultemails if frombook is limited to change realname only
+ if ($config{'frombook_for_realname_only'} || $prefshash{'email'} eq "") {
+@@ -708,19 +708,19 @@
+
+ # all rc entries are disallowed to be empty
+ foreach $key (@openwebmailrcitem) {
+- if (defined $config{'DEFAULT_'.$key}) {
++ if ( $config{'DEFAULT_'.$key}) {
+ $prefshash{$key}=$config{'DEFAULT_'.$key};
+- } elsif ((!defined $prefshash{$key}||$prefshash{$key} eq '') &&
+- defined $config{'default_'.$key} ) {
++ } elsif ((! $prefshash{$key}||$prefshash{$key} eq '') &&
++ $config{'default_'.$key} ) {
+ $prefshash{$key}=$config{'default_'.$key};
+ }
+ }
+- # signature allowed to be empty but not undefined
++ # signature allowed to be empty but not un
+ foreach $key ( 'signature') {
+- if (defined $config{'DEFAULT_'.$key}) {
++ if ( $config{'DEFAULT_'.$key}) {
+ $prefshash{$key}=$config{'DEFAULT_'.$key};
+- } elsif (!defined $prefshash{$key} &&
+- defined $config{'default_'.$key} ) {
++ } elsif (! $prefshash{$key} &&
++ $config{'default_'.$key} ) {
+ $prefshash{$key}=$config{'default_'.$key};
+ }
+ }
+@@ -765,7 +765,7 @@
+ my $commonfile="$config{'ow_templatesdir'}/COMMON/$templatename";
+
+ foreach my $file ($langfile, $commonfile) {
+- return $_templatecache{$file} if (defined $_templatecache{$file});
++ return $_templatecache{$file} if ( $_templatecache{$file});
+ }
+ foreach my $file ($langfile, $commonfile) {
+ if (sysopen(T, $file, O_RDONLY)) {
+@@ -786,7 +786,7 @@
+ my $stylefile = $_[0] || 'Default';
+ $stylefile = 'Default' if (!-f "$config{'ow_stylesdir'}/$stylefile");
+
+- if (!defined $_stylecache{"$config{'ow_stylesdir'}/$stylefile"}) {
++ if (! $_stylecache{"$config{'ow_stylesdir'}/$stylefile"}) {
+ my (%hash, $key, $value);
+ sysopen(STYLE, "$config{'ow_stylesdir'}/$stylefile", O_RDONLY) or
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'couldnt_read'} $config{'ow_stylesdir'}/$stylefile! ($!)");
+@@ -1013,7 +1013,7 @@
+ next if ($vu =~ /^@/); # ignore entries for whole domain mapping
+
+ $DB{$vu}=$u;
+- if (defined $DBR{$u}) {
++ if ( $DBR{$u}) {
+ $DBR{$u}.=",$vu";
+ } else {
+ $DBR{$u}.="$vu";
+@@ -1068,8 +1068,8 @@
+ $user=get_user_by_virtualuser($loginuser);
+ if ($user eq "") {
+ my @domainlist=($logindomain);
+- if (defined @{$config{'domain_equiv'}{'list'}{$logindomain}}) {
+- push(@domainlist, @{$config{'domain_equiv'}{'list'}{$logindomain}});
++ if ( {$config{'domain_equiv'}{'list'}{$logindomain}}) {
++ push(@domainlist, {$config{'domain_equiv'}{'list'}{$logindomain}});
+ }
+ foreach (@domainlist) {
+ $user=get_user_by_virtualuser("$loginuser\@$_");
+@@ -1152,7 +1152,7 @@
+ sub get_userfrom {
+ my ($logindomain, $loginuser, $user, $realname, $frombook)=@_;
+ my %from=();
+- $realname=$config{'DEFAULT_realname'} if (defined $config{'DEFAULT_realname'});
++ $realname=$config{'DEFAULT_realname'} if ( $config{'DEFAULT_realname'});
+
+ # get default fromemail
+ my @defaultemails=get_defaultemails($logindomain, $loginuser, $user);
+@@ -1160,12 +1160,12 @@
+ $from{$_}=$realname;
+ }
+
+- # get user defined fromemail
++ # get user fromemail
+ if ($config{'enable_loadfrombook'} && sysopen(FROMBOOK, $frombook, O_RDONLY)) {
+ while (<FROMBOOK>) {
+ my ($_email, $_realname) = split(/\@\@\@/, $_, 2); chomp($_realname);
+- $_realname=$config{'DEFAULT_realname'} if (defined $config{'DEFAULT_realname'});
+- if (!$config{'frombook_for_realname_only'} || defined $from{$_email}) {
++ $_realname=$config{'DEFAULT_realname'} if ( $config{'DEFAULT_realname'});
++ if (!$config{'frombook_for_realname_only'} || $from{$_email}) {
+ $from{"$_email"} = $_realname;
+ }
+ }
+@@ -1226,8 +1226,8 @@
+ sub httpheader {
+ my %headers=@_;
+ $headers{'-charset'} = $prefs{'charset'} if ($CGI::VERSION>=2.57);
+- if (!defined $headers{'-Cache-Control'} &&
+- !defined $headers{'-Expires'} ) {
++ if (! $headers{'-Cache-Control'} &&
++ ! $headers{'-Expires'} ) {
+ $headers{'-Pragma'}='no-cache';
+ $headers{'-Cache-Control'}='no-cache,no-store';
+ }
+@@ -1283,7 +1283,7 @@
+ sub htmlplugin {
+ my ($file, $fromcharset, $tocharset)=@_;
+ my $html='';
+- if ($file ne '' && open(F, $file) ) { # $file is defined in config file, which may be a pipe
++ if ($file ne '' && open(F, $file) ) { # $file is in config file, which may be a pipe
+ local $/; undef $/; $html=<F>; # no separator, read whole file in once
+ close(F);
+ $html=~s/\%THISSESSION\%/$thissession/;
+@@ -1337,7 +1337,7 @@
+ $stackdump=~s/^\s*//gm;
+ }
+
+- if (defined $ENV{'GATEWAY_INTERFACE'}) { # in CGI mode
++ if ( $ENV{'GATEWAY_INTERFACE'}) { # in CGI mode
+ # load prefs if possible, or use default value
+ my $background = $style{"background"}||"#FFFFFF"; $background =~ s/"//g;
+ my $bgurl=$prefs{'bgurl'}||$config{'default_bgurl'};
+@@ -1401,7 +1401,7 @@
+ my ($title, $msg, $time, $jscode)=@_;
+ $time=5 if ($time<3);
+
+- if (defined $ENV{'GATEWAY_INTERFACE'}) { # in CGI mode
++ if ( $ENV{'GATEWAY_INTERFACE'}) { # in CGI mode
+ my ($html, $temphtml);
+ $html = applystyle(readtemplate("autoclose.template"));
+
+@@ -1439,7 +1439,7 @@
+ close(LOGFILE);
+ } else {
+ # show log error only if CGI mode
+- if (defined $ENV{'GATEWAY_INTERFACE'}) {
++ if ( $ENV{'GATEWAY_INTERFACE'}) {
+ openwebmailerror(__FILE__, __LINE__, "$lang_err{'couldnt_write'} $config{'logfile'}! ($!)");
+ }
+ }
+@@ -1664,7 +1664,7 @@
+ sub resolv_symlink {
+ my ($i, $path, @p)=(0, '', path2array($_[0]));
+ my ($path0, %mapped);
+- while(defined($_=shift(@p)) && $i<20) {
++ while(($_=shift(@p)) && $i<20) {
+ $path0=$path;
+ $path.="/$_";
+ if (-l $path) {
+@@ -1698,7 +1698,7 @@
+
+ ########## IS_ADM ################################################
+ sub is_vdomain_adm {
+- if (defined @{$config{'vdomain_admlist'}}) {
++ if ( @{$config{'vdomain_admlist'}}) {
+ foreach my $adm (@{$config{'vdomain_admlist'}}) {
+ return 1 if ($_[0] eq $adm); # $_[0] is the user
+ }
+@@ -1920,7 +1920,7 @@
+
+ return 0 if (!ow::dbm::exist($autologindb));
+ return 0 if (!ow::dbm::open(\%DB, $autologindb, LOCK_EX));
+- $DB{$agentip}=$timestamp=time() if (defined $DB{$agentip});
++ $DB{$agentip}=$timestamp=time() if ( $DB{$agentip});
+ ow::dbm::close(\%DB, $autologindb);
+ return 1 if ($timestamp ne '');
+ }
+@@ -1942,14 +1942,14 @@
+ sub get_defaultfolders {
+ my @f;
+ foreach (@_defaultfolders) {
+- next if (defined $_folder_config{$_} && !$config{$_folder_config{$_}});
++ next if ( $_folder_config{$_} && !$config{$_folder_config{$_}});
+ push(@f, $_);
+ }
+ return(@f);
+ }
+
+ sub is_defaultfolder {
+- return 0 if (defined $_folder_config{$_[0]} && !$config{$_folder_config{$_[0]}});
++ return 0 if ( $_folder_config{$_[0]} && !$config{$_folder_config{$_[0]}});
+ return 1 if ($_is_defaultfolder{$_[0]});
+ return 0;
+ }
diff --git a/2542/openwebmail.spec b/2543/openwebmail.spec
index 85f8d84..535e0ee 100644
--- a/2542/openwebmail.spec
+++ b/2543/openwebmail.spec
@@ -1,6 +1,6 @@
Name : openwebmail
Version : 2.54
-Release : 2.el7
+Release : 3.el8
BuildArch : noarch
License : GPLv2
@@ -21,9 +21,15 @@ Source5 : openwebmail-httpd.conf
Source6 : openwebmail-tool
Source7 : openwebmail-post.txt
+Patch0 : el8_ow-shared.pl.patch
+Patch1 : el8_mailfilter.pl.patch
+Patch2 : el8_openwebmail-send.pl.patch
+Patch3 : el8_getmessage.pl.patch
+
Requires : perl
#Requires : perl-suidperl
#Requires : perl-Compress-Zlib
+Requires : perl-CGI
Requires : perl-Data-Dumper
Requires : perl-IO-Compress
Requires : perl-Text-Iconv
@@ -62,6 +68,13 @@ rm -rf %{buildroot}
%install
mkdir -p %{buildroot}/var/www/{cgi-bin,data,html}
tar -zxBpf %{SOURCE0} --directory=%{buildroot}/var/www
+
+cd %{buildroot}/var/www
+patch -p0 < %{PATCH0}
+patch -p0 < %{PATCH1}
+patch -p0 < %{PATCH2}
+patch -p0 < %{PATCH3}
+
install -p -m644 %{SOURCE1} %{buildroot}/var/www/cgi-bin/openwebmail/etc/openwebmail.conf
install -p -m644 %{SOURCE2} %{buildroot}/var/www/cgi-bin/openwebmail/etc/auth_unix.conf
mkdir -p %{buildroot}/etc/smrsh
@@ -121,12 +134,16 @@ doc, help, images, javascripts, sounds, applets and html files.
/var/www/data/openwebmail
%changelog
+* Tue Nov 05 2019 Thomas Chung <[email protected]> 2.54-3
+- Rebuild for EL8
+- Add 4 Patches to be compatible with perl 5.26
+
* Sat Nov 02 2019 Thomas Chung <[email protected]> 2.54-2
- Add perl-Data-Dumper in Requires
* Sat Dec 06 2014 Thomas Chung <[email protected]> 2.54-1
- No more suidperl
-- Rebuild from EL 7 with noarch
+- Rebuild for EL7
* Thu Feb 21 2008 Thomas Chung <[email protected]> 2.53-3
- Fix default attributes for all files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment