#9143 Fixed empty license encryption key

This commit is contained in:
Daniel Maya 2022-09-29 11:46:29 +02:00
parent 197fa4c69a
commit c650e7df6c
2 changed files with 19 additions and 19 deletions

View File

@ -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));
}

View File

@ -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));
}