From 1f14f7c327e52ec67a593d3d0b87e67a4bf7ebd6 Mon Sep 17 00:00:00 2001 From: Ruben Calvo Date: Tue, 30 Oct 2018 11:16:51 +0000 Subject: [ticket/15860] Fix format of backup files PHPBB3-15860 --- phpBB/includes/acp/acp_database.php | 4 ++-- phpBB/includes/functions.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index b98756a34b..fbc4f045ad 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -203,7 +203,7 @@ class acp_database $file = $request->variable('file', ''); $download = $request->variable('download', ''); - if (!preg_match('#^backup_\d{10,}_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) + if (!preg_match('#^backup_\d{10,}_[a-z\d]+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) { trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -402,7 +402,7 @@ class acp_database { while (($file = readdir($dh)) !== false) { - if (preg_match('#^backup_(\d{10,})_[a-z\d]{16}\.(sql(?:\.(?:gz|bz2))?)$#', $file, $matches)) + if (preg_match('#^backup_(\d{10,})_[a-z\d]+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) { if (in_array($matches[2], $methods)) { diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3fec88a354..79d88fb3a5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -115,7 +115,7 @@ function gen_rand_string_friendly($num_chars = 8) */ function unique_id() { - return gen_rand_string(32); + return strtolower(gen_rand_string(32)); } /** -- cgit v1.2.1 From bab86aac7fac57af6f40d327fb04970b2aecd158 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Tue, 30 Oct 2018 20:45:09 +0000 Subject: [ticket/15860] Limit regexp to expected formats PHPBB3-15860 --- phpBB/includes/acp/acp_database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index fbc4f045ad..91d49a45b0 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -203,7 +203,7 @@ class acp_database $file = $request->variable('file', ''); $download = $request->variable('download', ''); - if (!preg_match('#^backup_\d{10,}_[a-z\d]+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) + if (!preg_match('#^backup_\d{10,}_(?:[a-z\d]{16}|[a-z\d]{32})+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) { trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } -- cgit v1.2.1 From fa1fd316fe878197db4e0a390722053829e2e317 Mon Sep 17 00:00:00 2001 From: Ruben Calvo Date: Tue, 30 Oct 2018 22:56:20 +0000 Subject: [ticket/15860] Fix regexp PHPBB3-15860 --- phpBB/includes/acp/acp_database.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB') diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 91d49a45b0..19c4f6e4f1 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -203,7 +203,7 @@ class acp_database $file = $request->variable('file', ''); $download = $request->variable('download', ''); - if (!preg_match('#^backup_\d{10,}_(?:[a-z\d]{16}|[a-z\d]{32})+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) + if (!preg_match('#^backup_\d{10,}_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) { trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); } @@ -402,7 +402,7 @@ class acp_database { while (($file = readdir($dh)) !== false) { - if (preg_match('#^backup_(\d{10,})_[a-z\d]+\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) + if (preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) { if (in_array($matches[2], $methods)) { -- cgit v1.2.1 From 31703585cb2faf9ca0c2072ebabdc2b3ec62e146 Mon Sep 17 00:00:00 2001 From: Ruben Calvo Date: Wed, 31 Oct 2018 10:41:57 +0000 Subject: [ticket/15860] Unique_id() return 16 characters again PHPBB3-15860 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 79d88fb3a5..99f65a0e92 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -115,7 +115,7 @@ function gen_rand_string_friendly($num_chars = 8) */ function unique_id() { - return strtolower(gen_rand_string(32)); + return strtolower(gen_rand_string(16)); } /** -- cgit v1.2.1