From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter =?utf-8?q?M=C3=BCller?= To: development@lists.ipfire.org Subject: [PATCH v2 1/2] mail.cgi: add support for implicit TLS usage Date: Mon, 03 Feb 2020 18:35:00 +0000 Message-ID: <2a6c0c35-df5a-5b9b-1117-ba533448a51f@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8786379581428210663==" List-Id: --===============8786379581428210663== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The second version of this patchset fixes reading empty configuration files and superseds the first version (duh!). Fixes #12161 Reported-by: Michael Tremer Signed-off-by: Peter M=C3=BCller --- html/cgi-bin/mail.cgi | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/html/cgi-bin/mail.cgi b/html/cgi-bin/mail.cgi index 25589046e..7865a1da6 100755 --- a/html/cgi-bin/mail.cgi +++ b/html/cgi-bin/mail.cgi @@ -2,7 +2,7 @@ ############################################################################= ### # = # # IPFire.org - A linux based firewall = # -# Copyright (C) 2015 IPFire Team = # +# Copyright (C) 2007-2020 IPFire Team = # # = # # This program is free software: you can redistribute it and/or modify = # # it under the terms of the GNU General Public License as published by = # @@ -110,8 +110,8 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}"){ #SaveBu= tton on configsite =20 $dma{'SMARTHOST'} =3D $cgiparams{'txt_mailserver'}; $dma{'PORT'} =3D $cgiparams{'txt_mailport'}; - $dma{'STARTTLS'} =3D '' if ($cgiparams{'mail_tls'}); - $dma{'SECURETRANSFER'} =3D '' if exists $dma{'STARTTLS'}; + $dma{'STARTTLS'} =3D '' if ($cgiparams{'mail_tls'} eq 'explicit'); + $dma{'SECURETRANSFER'} =3D '' if ($cgiparams{'mail_tls'} eq 'explicit' || = $cgiparams{'mail_tls'} eq 'implicit'); $dma{'SPOOLDIR'} =3D "/var/spool/dma"; $dma{'FULLBOUNCE'} =3D ''; $dma{'MAILNAME'} =3D "$mainsettings{'HOSTNAME'}.$mainsettings{DOMAINNAME}= "; @@ -140,8 +140,6 @@ if ($cgiparams{'ACTION'} eq "$Lang::tr{'email testmail'}"= ){ #Testmail button on =20 #FUNCTIONS sub configsite{ -=09 - #If update set fieldvalues new if($cgiparams{'update'} eq 'on'){ $mail{'USEMAIL'} =3D 'on'; @@ -156,7 +154,9 @@ sub configsite{ } #find preselections $checked{'usemail'}{$mail{'USEMAIL'}} =3D 'CHECKED'; - $checked{'mail_tls'}{'on'} =3D 'CHECKED' if exists $dma{'STARTTLS'}; + $selected{'mail_tls'}{'explicit'} =3D 'selected' if exists $dma{'STARTTLS'}; + $selected{'mail_tls'}{'implicit'} =3D 'selected' if (exists $dma{'SECURETRA= NSFER'}) and (not exists $dma{'STARTTLS'}); + $selected{'mail_tls'}{'disabled'} =3D 'selected' if (not exists $dma{'SECUR= ETRANSFER'}) and (not exists $dma{'STARTTLS'}); =09 #Open site &Header::openpage($Lang::tr{'email settings'}, 1, ''); @@ -226,7 +226,13 @@ END $Lang::tr{'email tls'} - + + + END if (! -z $dmafile && $mail{'USEMAIL'} eq 'on' && !$errormessage){ --=20 2.16.4 --===============8786379581428210663==--