Skip to content
Snippets Groups Projects
Commit 3a62efd6 authored by Jared Hancock's avatar Jared Hancock
Browse files

Fix md5 hash on windows platforms

The installer compares the md5 of the on-disk sql install file with the
signature file shipped alongside. If the signatures do not match, it will
refuse to install osTicket. On Windows(TM) platforms, PHP will automatically
translate newlines to Windows newlines (CRLF), which will corrupt the MD5
hash of the file.

This patch opens the file in binary mode explicitly to prevent the automatic
conversion.
parent f4c39bd6
No related branches found
No related tags found
No related merge requests found
......@@ -113,10 +113,14 @@ class Installer extends SetupWizard {
$debug = true; //XXX:Change it to true to show SQL errors.
//Last minute checks.
if(!file_exists($schemaFile))
if(!file_exists($schemaFile) || !($fp = fopen($schemaFile, 'rb')))
$this->errors['err']='Internal Error - please make sure your download is the latest (#1)';
elseif(!($signature=trim(file_get_contents("$schemaFile.md5"))) || strcasecmp($signature, md5_file($schemaFile)))
$this->errors['err']='Unknown or invalid schema signature ('.$signature.' .. '.md5_file($schemaFile).')';
elseif(
!($signature=trim(file_get_contents("$schemaFile.md5")))
|| !($hash=md5(fread($fp, filesize($schemaFile))))
|| strcasecmp($signature, $hash))
$this->errors['err']='Unknown or invalid schema signature ('
.$signature.' .. '.$hash.')';
elseif(!file_exists($this->getConfigFile()) || !($configFile=file_get_contents($this->getConfigFile())))
$this->errors['err']='Unable to read config file. Permission denied! (#2)';
elseif(!($fp = @fopen($this->getConfigFile(),'r+')))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment