Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Fix mysql migration, daemon buffer overflow, database backup recover #2479

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions daemon/lmsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ int main(int argc, char *argv[], char **envp)
str_replace(&driver, "postgres", "pgsql"); // postgres in ini file is pgsql
str_replace(&driver, "mysqli", "mysql"); // mysqli in ini file is mysql

char dbdrv_path[strlen(LMS_LIB_DIR) + strlen(driver) + 4];
sprintf(dbdrv_path, LMS_LIB_DIR "/%s.so", driver);
char dbdrv_path[strlen(LMS_LIB_DIR) + strlen(driver) + 5];
snprintf(dbdrv_path, sizeof(dbdrv_path), "%s/%s.so", LMS_LIB_DIR, driver);

if( !file_exists(dbdrv_path))
{
Expand Down
13 changes: 2 additions & 11 deletions lib/upgradedb/mysql.2022092200.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,10 @@
*
*/

define('CONTACT_NOTIFICATIONS_2022092201', 32);
define('CONTACT_HELPDESK_NOTIFICATIONS_2022092201', 131072);

$this->BeginTrans();

$this->Execute(
"UPDATE customercontacts SET type = type | ? WHERE (type & ?) > 0",
array(
CONTACT_HELPDESK_NOTIFICATIONS_2022092201,
CONTACT_NOTIFICATIONS_2022092201,
)
);
$this->Execute("ALTER TABLE assignments ADD COLUMN paytime smallint DEFAULT NULL");

$this->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2022092201', 'dbversion'));
$this->Execute("UPDATE dbinfo SET keyvalue = ? WHERE keytype = ?", array('2022092200', 'dbversion'));

$this->CommitTrans();
3 changes: 2 additions & 1 deletion modules/dbrecover.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ function DBLoad($filename = null)
$layout['pagetitle'] = trans('Database Backup Recovery');
$SMARTY->display('header.html');
echo '<H1>'.trans('Database Backup Recovery').'</H1>';
echo '<P>'.trans('Are you sure, you want to recover database created at $a?', date('Y/m/d H:i.s', $_GET['db'])).'</P>';
$timestamp = explode('-', $_GET['db'])[0];
echo '<P>'.trans('Are you sure, you want to recover database created at $a?', date('Y/m/d H:i.s', $timestamp)).'</P>';
echo '<A href="?m=dbrecover&db='.$_GET['db'].'&is_sure=1">'.trans('Yes, I am sure.').'</A>';
$SMARTY->display('footer.html');
}
2 changes: 1 addition & 1 deletion templates/default/dblist.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ <H1>{$layout.pagetitle}</H1>
});
$('.recover-backup').click(function() {
confirmDialog($t("Are you sure, you want to restore this database backup?\n\nWARNING!\n\nIt will backup current database content automatically"), this).done(function() {
location.href = $(this).attr('href');
location.href = $(this).attr('href') + '&is_sure=1';
});
return false;
});
Expand Down