Commit a156c466 authored by Ad Schellevis's avatar Ad Schellevis

reformat tag line of encrypted backup

parent a453bfe8
......@@ -447,7 +447,8 @@ function backup_to_google_drive() {
$client->login($config->system->remotebackup->GDriveEmail->__toString(), $config->system->remotebackup->GDriveP12key->__toString() );
// backup source data to local strings (plain/encrypted)
$confdata = file_get_contents('/conf/config.xml') ;
$confdata_enc = encrypt_data($confdata, $config->system->remotebackup->GDrivePassword->__toString()) ;
$confdata_enc = encrypt_data($confdata, $config->system->remotebackup->GDrivePassword->__toString()) ;
tagfile_reformat($confdata_enc, $confdata_enc, "config.xml");
// read filelist (config-*.xml) and cleanup old files
......
......@@ -291,7 +291,6 @@ if ($_POST) {
if ($_POST['decrypt']) {
if (!tagfile_deformat($data, $data, "config.xml")) {
$input_errors[] = gettext("The uploaded file does not appear to contain an encrypted OPNsense configuration.");
return 1;
}
$data = decrypt_data($data, $_POST['decrypt_password']);
}
......@@ -321,7 +320,7 @@ if ($_POST) {
}
}
} else {
if(true) {
if(!$input_errors) {
/* restore the entire configuration */
$filename = $_FILES['conffile']['tmp_name'];
file_put_contents($filename, $data);
......@@ -505,20 +504,20 @@ if ($_POST) {
unset($config['system']['remotebackup']['GDriveP12key']);
}
write_config();
// test / perform backup
try {
$filesInBackup = backup_to_google_drive() ;
} catch (Exception $e) {
$filesInBackup = array() ;
}
write_config();
// test / perform backup
try {
$filesInBackup = backup_to_google_drive() ;
} catch (Exception $e) {
$filesInBackup = array() ;
}
if (count($filesInBackup) == 0) {
$input_errors[] = gettext("Google Drive communication failure");
} else {
$input_messages = gettext("Backup succesfull, current filelist:");
if (count($filesInBackup) == 0) {
$input_errors[] = gettext("Google Drive communication failure");
} else {
$input_messages = gettext("Backup succesfull, current filelist:");
foreach ($filesInBackup as $filename => $file) {
$input_messages = $input_messages . "<br>" . $filename ;
$input_messages = $input_messages . "<br>" . $filename ;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment