From c650e7df6c9aff7a8a22b29172618268612bdad2 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 29 Sep 2022 11:46:29 +0200 Subject: [PATCH] #9143 Fixed empty license encryption key --- pandora_console/godmode/setup/license.php | 36 +++++++++++------------ pandora_console/include/functions_api.php | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pandora_console/godmode/setup/license.php b/pandora_console/godmode/setup/license.php index 6dc3df0d10..9be97a8685 100644 --- a/pandora_console/godmode/setup/license.php +++ b/pandora_console/godmode/setup/license.php @@ -78,25 +78,25 @@ if ($update_settings) { $customer_key = $_POST['keys']['customer_key']; - $license_encryption_key = get_parameter('license_encryption_key', false); - if ($license_encryption_key !== false) { - $check = db_get_value_sql('SELECT `key` FROM tupdate_settings WHERE `key` LIKE "license_encryption_key"'); - if ($check === false) { - db_process_sql_insert( - 'tupdate_settings', - [ - db_escape_key_identifier('value') => $license_encryption_key, - db_escape_key_identifier('key') => 'license_encryption_key', - ] - ); - } else { - db_process_sql_update( - 'tupdate_settings', - [db_escape_key_identifier('value') => $license_encryption_key], - [db_escape_key_identifier('key') => 'license_encryption_key'] - ); - } + $license_encryption_key = get_parameter('license_encryption_key', ''); + $check = db_get_value_sql('SELECT `key` FROM tupdate_settings WHERE `key` LIKE "license_encryption_key"'); + if ($check === false) { + db_process_sql_insert( + 'tupdate_settings', + [ + db_escape_key_identifier('value') => $license_encryption_key, + db_escape_key_identifier('key') => 'license_encryption_key', + ] + ); + } else { + db_process_sql_update( + 'tupdate_settings', + [db_escape_key_identifier('value') => $license_encryption_key], + [db_escape_key_identifier('key') => 'license_encryption_key'] + ); + } + if (empty($license_encryption_key) === false) { $customer_key = openssl_blowfish_encrypt_hex($customer_key, io_safe_output($license_encryption_key)); } diff --git a/pandora_console/include/functions_api.php b/pandora_console/include/functions_api.php index b174dc8d57..b958ff2c0e 100644 --- a/pandora_console/include/functions_api.php +++ b/pandora_console/include/functions_api.php @@ -14752,7 +14752,7 @@ function api_set_metaconsole_license_file($key) } $license_encryption_key = db_get_value('value', 'tupdate_settings', '`key`', 'license_encryption_key'); - if ($license_encryption_key !== false) { + if (empty($license_encryption_key) === false) { $key = openssl_blowfish_encrypt_hex($key, io_safe_output($license_encryption_key)); }