diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-08-23 16:50:16 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-08-23 16:50:16 -0400 |
commit | 8f022a561a6e1cc3779edcf6089b0218c42a6d74 (patch) | |
tree | 29de6c75102adbb7799cbf930e4ace8d053ba4e8 /config/autoconfigbackup/autoconfigbackup.php | |
parent | b39ab78a8cd15d93dad3e4f8819bb475f7a56be8 (diff) | |
download | pfsense-packages-8f022a561a6e1cc3779edcf6089b0218c42a6d74.tar.gz pfsense-packages-8f022a561a6e1cc3779edcf6089b0218c42a6d74.tar.bz2 pfsense-packages-8f022a561a6e1cc3779edcf6089b0218c42a6d74.zip |
Unbreak ACB restore
Diffstat (limited to 'config/autoconfigbackup/autoconfigbackup.php')
-rw-r--r-- | config/autoconfigbackup/autoconfigbackup.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/config/autoconfigbackup/autoconfigbackup.php b/config/autoconfigbackup/autoconfigbackup.php index 116bb4bd..f0c5741d 100644 --- a/config/autoconfigbackup/autoconfigbackup.php +++ b/config/autoconfigbackup/autoconfigbackup.php @@ -195,7 +195,12 @@ function get_hostnames() { $data = $data_split[1]; if (!tagfile_deformat($data, $data, "config.xml")) $input_errors[] = "The downloaded file does not appear to contain an encrypted pfSense configuration."; - $data = decrypt_data($data, $decrypt_password); + $out = decrypt_data($data, $decrypt_password); + + $pos = stripos($out, "</pfsense>"); + $data = substr($out, 0, $pos); + $data = $data . "</pfsense>\n"; + $fd = fopen("/tmp/config_restore.xml", "w"); fwrite($fd, $data); fclose($fd); @@ -204,7 +209,7 @@ function get_hostnames() { $ondisksha256 = trim(`/sbin/sha256 /tmp/config_restore.xml | awk '{ print $4 }'`); if($sha256 != "0" && $sha256 != "") // we might not have a sha256 on file for older backups if($ondisksha256 <> $sha256) - $input_errors[] = "SHA256 values do not match, cannot restore."; + $input_errors[] = "SHA256 values do not match, cannot restore. $ondisksha256 <> $sha256"; if (curl_errno($curl_session)) { /* If an error occured, log the error in /tmp/ */ $fd = fopen("/tmp/acb_restoredebug.txt", "w"); @@ -233,7 +238,7 @@ EOF; } else { log_error("There was an error when restoring the AutoConfigBackup item"); } - unlink("/tmp/config_restore.xml"); + //unlink("/tmp/config_restore.xml"); } if($_REQUEST['download']) { // Phone home and obtain backups |