summaryrefslogtreecommitdiffstats
path: root/etc/inc/pfsense-utils.inc
diff options
context:
space:
mode:
authorErmal Luçi <eri@pfsense.org>2009-08-24 12:05:28 +0000
committerErmal Luçi <eri@pfsense.org>2009-08-24 12:05:28 +0000
commitda17d77e63068481522ad42cca8a020ca31ef639 (patch)
treecd4cf68ad91bee427c91f2499ccdd6df8dcab3ba /etc/inc/pfsense-utils.inc
parent8f192f4e81a83d52d46c26d7c78a228474dc4d07 (diff)
downloadpfsense-da17d77e63068481522ad42cca8a020ca31ef639.zip
pfsense-da17d77e63068481522ad42cca8a020ca31ef639.tar.gz
* In config_install validate the file that will be installed not the already present config!
* Convert most hardcoded /tmp to the global variable * Do not reboot the firewall under the hood without confirmation from the user after restoring. Just ask the user to do it. * Fix various things in restore/backup code.
Diffstat (limited to 'etc/inc/pfsense-utils.inc')
-rw-r--r--etc/inc/pfsense-utils.inc24
1 files changed, 14 insertions, 10 deletions
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index bd279a7..69e65bc 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -128,7 +128,8 @@ function is_private_ip($iptocheck) {
* returns a temporary filename
******/
function get_tmp_file() {
- return "/tmp/tmp-" . time();
+ global $g;
+ return "{$g['tmp_path']}/tmp-" . time();
}
/****f* pfsense-utils/find_number_of_needed_carp_interfaces
@@ -893,9 +894,10 @@ Content-Length: $content_length
* php_check_syntax($code_tocheck, $errormessage): checks $code_to_check for errors
*/
if (!function_exists('php_check_syntax')){
+ global $g;
function php_check_syntax($code_to_check, &$errormessage){
return false;
- $fout = fopen("/tmp/codetocheck.php","w");
+ $fout = fopen("{$g['tmp_path']}/codetocheck.php","w");
$code = $_POST['content'];
$code = str_replace("<?php", "", $code);
$code = str_replace("?>", "", $code);
@@ -903,7 +905,7 @@ if (!function_exists('php_check_syntax')){
fwrite($fout, $code_to_check);
fwrite($fout, "\n\n?>\n");
fclose($fout);
- $command = "/usr/local/bin/php -l /tmp/codetocheck.php";
+ $command = "/usr/local/bin/php -l {$g['tmp_path']}/codetocheck.php";
$output = exec_command($command);
if (stristr($output, "Errors parsing") == false) {
echo "false\n";
@@ -1084,7 +1086,7 @@ function reload_interfaces_sync() {
log_error("Removing {$g['tmp_path']}/reloading_all");
/* start devd back up */
- mwexec("/bin/rm /tmp/reload*");
+ mwexec("/bin/rm {$g['tmp_path']}/reload*");
}
/****f* pfsense-utils/reload_all
@@ -1096,7 +1098,8 @@ function reload_interfaces_sync() {
* none
******/
function reload_all() {
- touch("/tmp/reload_all");
+ global $g;
+ touch("{$g['tmp_path']}/reload_all");
}
/****f* pfsense-utils/reload_interfaces
@@ -1108,7 +1111,8 @@ function reload_all() {
* none
******/
function reload_interfaces() {
- touch("/tmp/reload_interfaces");
+ global $g;
+ touch("{$g['tmp_path']}/reload_interfaces");
}
/****f* pfsense-utils/reload_all_sync
@@ -1167,12 +1171,12 @@ function reload_all_sync() {
conf_mount_ro();
/* restart sshd */
- @touch("/tmp/start_sshd");
+ @touch("{$g['tmp_path']}/start_sshd");
/* restart webConfigurator if needed */
- touch("/tmp/restart_webgui");
+ touch("{$g['tmp_path']}/restart_webgui");
- mwexec("/bin/rm /tmp/reload*");
+ mwexec("/bin/rm {$g['tmp_path']}/reload*");
}
function auto_login($status) {
@@ -1780,4 +1784,4 @@ function update_progress_bar($percent) {
}
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud