From 38dad81a2c7e033205f8d2cdb1c4f6a52081bc23 Mon Sep 17 00:00:00 2001 From: jim-p Date: Sun, 11 Oct 2009 17:06:31 -0400 Subject: Add rw/ro calls to TFTP package. May fix its issues on nano --- config/tftp/tftp_files.tmp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'config') diff --git a/config/tftp/tftp_files.tmp b/config/tftp/tftp_files.tmp index 92d34e70..3141b8fa 100644 --- a/config/tftp/tftp_files.tmp +++ b/config/tftp/tftp_files.tmp @@ -33,9 +33,11 @@ require("/usr/local/pkg/tftp.inc"); $filename = $_GET['filename']; if (($_GET['a'] == "download") && $_GET['t'] == "backup") { + conf_mount_rw(); $tmp = '/root/backup/'; $filename = 'tftp.bak.tgz'; system('cd /;tar cvzf /root/backup/tftp.bak.tgz tftpboot'); + conf_mount_ro(); } if (($_GET['a'] == "download") && file_exists("/root/backup/".$filename)) { @@ -62,9 +64,11 @@ if ($_GET['a'] == "other") { //extract a specific directory to /tftpboot if (file_exists('/root/backup/'.$filename)) { //echo "The file $filename exists"; + conf_mount_rw(); system('cd /; tar xvpfz /root/backup/'.$filename); system('chmod -R 744 /tftpboot/*'); header( 'Location: tftp_files.php?savemsg=Backup+has+been+restored.' ) ; + conf_mount_ro(); } else { header( 'Location: tftp_files.php?savemsg=Restore+failed.+Backup+file+not+found.' ) ; @@ -76,16 +80,20 @@ if ($_GET['a'] == "other") { if (($_POST['submit'] == "Upload") && is_uploaded_file($_FILES['ulfile']['tmp_name'])) { + conf_mount_rw(); move_uploaded_file($_FILES['ulfile']['tmp_name'], "/tftpboot/" . $_FILES['ulfile']['name']); $savemsg = "Uploaded file to /tftpboot/" . htmlentities($_FILES['ulfile']['name']); system('chmod -R 744 /tftpboot/*'); unset($_POST['txtCommand']); + conf_mount_ro(); } if ($_GET['act'] == "del") { if ($_GET['type'] == 'tftp') { + conf_mount_rw(); unlink_if_exists("/tftpboot/".$_GET['filename']); + conf_mount_ro(); header("Location: tftp_files.php"); exit; } -- cgit v1.2.3