diff --git a/webmail/common.php b/webmail/common.php index d7d2436..c9941be 100644 --- a/webmail/common.php +++ b/webmail/common.php @@ -11,7 +11,7 @@ * * @package NOCC * @license http://www.gnu.org/licenses/ GNU General Public License - * @version SVN: $Id: common.php 3075 2023-03-15 09:14:06Z oheil $ + * @version SVN: $Id: common.php 3080 2023-03-16 15:35:07Z oheil $ */ define('NOCC_DEBUG_LEVEL', 0); @@ -57,7 +57,7 @@ require_once './utils/crypt.php'; require_once './utils/translation.php'; $conf->nocc_name = 'NOCC'; -$conf->nocc_version = '1.9.14'; +$conf->nocc_version = '1.9.15-dev'; $conf->nocc_url = 'http://nocc.sourceforge.net/'; $pwd_to_encrypt = false; diff --git a/webmail/docs/NEWS b/webmail/docs/NEWS index 66e56e5..fae0a1e 100644 --- a/webmail/docs/NEWS +++ b/webmail/docs/NEWS @@ -1,5 +1,10 @@ -Latest version is 1.9.14 +Latest version is 1.9.15-dev + +NOCC 1.9.15 ?????????????? + + Misc + * Added sha256 checksum for automatic update (Oliver Heil). NOCC 1.9.14 March 15, 2023 @@ -7,8 +12,6 @@ NOCC 1.9.14 March 15, 2023 * Bug #511 : Auto-Update fails with php 8.2.3 (Oliver Heil). Creating an early release before people switch to php 8.2. -Latest version is 1.9.13 - NOCC 1.9.13 March 11, 2023 Misc diff --git a/webmail/update.php b/webmail/update.php index b1910f7..8bcc361 100644 --- a/webmail/update.php +++ b/webmail/update.php @@ -259,7 +259,7 @@ if( ! isset($_GET['doUpdate']) || $_GET['doUpdate']!=1 ) { echo '

Update:

'; echo ''; } @@ -385,25 +385,49 @@ else { } if( $state_ok ) { - echo '

Checking MD5 checksum

'; - $ckecksums=file_get_contents('http://nocc.sourceforge.net/checksums.txt'); + echo '

Checking checksum

'; + $ckecksums=file_get_contents('https://nocc.sourceforge.net/checksums.txt'); + $checksum=""; + $checksumType=""; $matches=array(); - if( preg_match("/".$archive_name."\t(\S+)\R/",$ckecksums,$matches) ) { - $md5sum=$matches[1]; + if( preg_match("/".$archive_name."\tsha256\t(\S+)\R/",$ckecksums,$matches) ) { + $checksum=$matches[1]; + $checksumType="sha256"; + } + else if( preg_match("/".$archive_name."\tmd5\t(\S+)\R/",$ckecksums,$matches) ) { + $checksum=$matches[1]; + $checksumType="md5"; + } + else if( preg_match("/".$archive_name."\t(\S+)\R/",$ckecksums,$matches) ) { + $checksum=$matches[1]; + $checksumType="md5"; + } + else { + echo '

Could not find checksum. See also http://nocc.sourceforge.net/download/

'; + $state_ok=false; + } + if( $checksumType == "md5" ) { $md5sum_check=md5_file($archive_name); - if( $md5sum==$md5sum_check) { - echo '

MD5 checksums match: '.$md5sum.'. See also http://nocc.sourceforge.net/download/

'; + if( $checksum == $md5sum_check) { + echo '

MD5 checksums match: '.$checksum.'. See also http://nocc.sourceforge.net/download/

'; } else { - echo '

Failed md5 checksum match: '.$md5sum_check.' should be '.$md5sum.'.

'; + echo '

Failed md5 checksum match: '.$md5sum_check.' should be '.$checksum.'.

'; echo '

See also http://nocc.sourceforge.net/download/

'; $state_ok=false; } } - else { - echo '

Could not find md5 checksum. See also http://nocc.sourceforge.net/download/

'; - $state_ok=false; - } + if( $checksumType == "sha256" ) { + $sha256sum_check=hash_file("sha256",$archive_name); + if( $checksum == $sha256sum_check ) { + echo '

sha256 checksums match: '.$checksum.'. See also http://nocc.sourceforge.net/download/

'; + } + else { + echo '

Failed sha256 checksum match: '.$sha256sum_check.' should be '.$checksum.'.

'; + echo '

See also http://nocc.sourceforge.net/download/

'; + $state_ok=false; + } + } } if( $state_ok ) {