aboutsummaryrefslogtreecommitdiffstats
path: root/config/tftp
diff options
context:
space:
mode:
authormcrane <mctch@yahoo.com>2009-03-27 19:08:43 -0600
committermcrane <mctch@yahoo.com>2009-03-27 19:08:43 -0600
commit7e6fad76175d9e872063dff755c0f74fec866821 (patch)
treecb1e59f9a0e21d0a1dab819a51af6077fd8ca7b2 /config/tftp
parent8cb1ca2f7873b63e7a15e156e72e3c487b62f16a (diff)
downloadpfsense-packages-7e6fad76175d9e872063dff755c0f74fec866821.tar.gz
pfsense-packages-7e6fad76175d9e872063dff755c0f74fec866821.tar.bz2
pfsense-packages-7e6fad76175d9e872063dff755c0f74fec866821.zip
TFTP package make the backup deliver the backup file as a download, fix restore and add restore message
Diffstat (limited to 'config/tftp')
-rw-r--r--config/tftp/tftp.inc3
-rw-r--r--config/tftp/tftp_files.tmp29
2 files changed, 17 insertions, 15 deletions
diff --git a/config/tftp/tftp.inc b/config/tftp/tftp.inc
index 8649bc22..61d81b4a 100644
--- a/config/tftp/tftp.inc
+++ b/config/tftp/tftp.inc
@@ -274,8 +274,9 @@ function php_deinstall_command()
unlink_if_exists("/usr/local/pkg/tftp.xml");
unlink_if_exists("/usr/local/pkg/tftp.inc");
unlink_if_exists("/usr/local/www/packages/tftp/tftp_files.php");
+ exec("rm -R /usr/local/www/packages/tftp/");
- exec("rm -R /tftpboot");
+ //exec("rm -R /tftpboot");
unlink_if_exists("/usr/local/etc/rc.d/tftp.sh");
unlink_if_exists("/tmp/pkg_mgr_tftp.log");
diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp
index f49ea76e..a5fb5ecc 100644
--- a/config/tftp/tftp_files.tmp
+++ b/config/tftp/tftp_files.tmp
@@ -37,18 +37,18 @@ if (($_GET['a'] == "download") && $_GET['t'] == "backup") {
$filename = 'tftp.bak.tgz';
system('cd /;tar cvzf /tmp/tftp.bak.tgz tftpboot');
}
-if (($_GET['a'] == "download") && file_exists("/tftpboot/".$filename)) {
-
+if (($_GET['a'] == "download") && file_exists("/tmp/".$filename)) {
+
session_cache_limiter('public');
- $fd = fopen("/tftpboot/".$filename, "rb");
+ $fd = fopen("/tmp/".$filename, "rb");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
- header('Content-Disposition: attachment; filename="'.$filename.'"');
+ header('Content-Disposition: attachment; filename="'.$filename.'"');
header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
- header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
- header("Content-Length: " . filesize("/tftpboot/".$filename));
+ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
+ header("Content-Length: " . filesize("/tmp/".$filename));
fpassthru($fd);
exit;
}
@@ -58,18 +58,18 @@ if ($_GET['a'] == "other") {
if ($_GET['t'] == "restore") {
$tmp = '/tmp/';
$filename = 'tftp.bak.tgz';
-
+
//extract a specific directory to /tftpboot
if (file_exists('/tmp/'.$filename)) {
//echo "The file $filename exists";
system('cd /; tar xvpfz /tmp/'.$filename);
- system('chmod -R 744 /tftpboot/*');
+ system('chmod -R 744 /tftpboot/*');
header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ;
}
else {
header( 'Location: tftp_files.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ;
- }
-
+ }
+
exit;
}
}
@@ -99,7 +99,8 @@ include("head.inc");
<?php include("fbegin.inc"); ?>
<p class="pgtitle">TFTP: Files</p>
-<?php
+<?php
+$savemsg = $_GET["savemsg"];
if ($savemsg) {
print_info_box($savemsg);
}
@@ -111,7 +112,7 @@ if ($savemsg) {
<?php
$tab_array = array();
- $tab_array[] = array(gettext("Files"), false, "/tftp/tftp_files.php");
+ $tab_array[] = array(gettext("Files"), false, "/packages/tftp/tftp_files.php");
display_top_tabs($tab_array);
?>
@@ -169,9 +170,9 @@ if ($savemsg) {
echo "<br /><br />\n";
echo "</td>\n";
echo "<td width='20%' valign='middle' align='right'>\n";
- echo " <input type='button' value='backup' onclick=\"document.location.href='/tftp/tftp_files.php?a=download&t=backup';\" />\n";
+ echo " <input type='button' value='backup' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=download&t=backup';\" />\n";
if (file_exists('/tmp/tftp.bak.tgz')) {
- echo " <input type='button' value='restore' onclick=\"document.location.href='/tftp/tftp_files.php?a=other&t=restore';\" />\n";
+ echo " <input type='button' value='restore' onclick=\"document.location.href='/packages/tftp/tftp_files.php?a=other&t=restore';\" />\n";
}
echo "</td>\n";
echo "</tr>\n";