Commit 1f5d30b8 authored by Franco Fichtner's avatar Franco Fichtner

src: tmp_path gone with the wind

parent ad334c80
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004 Scott Ullrich Copyright (C) 2004 Scott Ullrich
...@@ -28,19 +29,8 @@ ...@@ -28,19 +29,8 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
/*
pfSense_BUILDER_BINARIES: /bin/rm /bin/mkdir /usr/bin/fetch
pfSense_MODULE: aliases
*/
##|+PRIV require_once("guiconfig.inc");
##|*IDENT=page-firewall-alias-edit
##|*NAME=Firewall: Alias: Edit page
##|*DESCR=Allow access to the 'Firewall: Alias: Edit' page.
##|*MATCH=firewall_aliases_edit.php*
##|-PRIV
require("guiconfig.inc");
require_once("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
require_once("shaper.inc"); require_once("shaper.inc");
...@@ -70,8 +60,9 @@ if($_POST) ...@@ -70,8 +60,9 @@ if($_POST)
$origname = $_POST['origname']; $origname = $_POST['origname'];
// Debugging // Debugging
if($debug) if ($debug) {
unlink_if_exists("{$g['tmp_path']}/alias_rename_log.txt"); unlink_if_exists('/tmp/alias_rename_log.txt');
}
function alias_same_type($name, $type) { function alias_same_type($name, $type) {
global $config; global $config;
...@@ -203,7 +194,7 @@ if ($_POST) { ...@@ -203,7 +194,7 @@ if ($_POST) {
if($_POST['address' . $x]) { if($_POST['address' . $x]) {
/* fetch down and add in */ /* fetch down and add in */
$isfirst = 0; $isfirst = 0;
$temp_filename = tempnam("{$g['tmp_path']}/", "alias_import"); $temp_filename = tempnam('/tmp/', 'alias_import');
unlink_if_exists($temp_filename); unlink_if_exists($temp_filename);
$verify_ssl = isset($config['system']['checkaliasesurlcert']); $verify_ssl = isset($config['system']['checkaliasesurlcert']);
mkdir($temp_filename); mkdir($temp_filename);
......
...@@ -43,8 +43,8 @@ if ($_POST) { ...@@ -43,8 +43,8 @@ if ($_POST) {
$pconfig = $_POST; $pconfig = $_POST;
if ($_POST['apply']) { if ($_POST['apply']) {
if (file_exists("{$g['tmp_path']}/.firewall_virtual_ip.apply")) { if (file_exists('/tmp/.firewall_virtual_ip.apply')) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.firewall_virtual_ip.apply")); $toapplylist = unserialize(file_get_contents('/tmp/.firewall_virtual_ip.apply'));
foreach ($toapplylist as $vid => $ovip) { foreach ($toapplylist as $vid => $ovip) {
if (!empty($ovip)) if (!empty($ovip))
interface_vip_bring_down($ovip); interface_vip_bring_down($ovip);
...@@ -64,7 +64,7 @@ if ($_POST) { ...@@ -64,7 +64,7 @@ if ($_POST) {
} }
} }
} }
@unlink("{$g['tmp_path']}/.firewall_virtual_ip.apply"); @unlink('/tmp/.firewall_virtual_ip.apply');
} }
$retval = 0; $retval = 0;
$retval |= filter_configure(); $retval |= filter_configure();
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>. Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2004-2005 Scott Ullrich <geekgod@pfsense.com>. Copyright (C) 2004-2005 Scott Ullrich <geekgod@pfsense.com>.
...@@ -28,9 +29,9 @@ ...@@ -28,9 +29,9 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require("guiconfig.inc"); require_once("guiconfig.inc");
require_once("filter.inc"); require_once("filter.inc");
require("shaper.inc"); require_once("shaper.inc");
$referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_virtual_ip.php'); $referer = (isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '/firewall_virtual_ip.php');
...@@ -211,10 +212,11 @@ if ($_POST) { ...@@ -211,10 +212,11 @@ if ($_POST) {
if (!isset($id)) if (!isset($id))
$id = count($a_vip); $id = count($a_vip);
if (file_exists("{$g['tmp_path']}/.firewall_virtual_ip.apply")) if (file_exists('/tmp/.firewall_virtual_ip.apply')) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.firewall_virtual_ip.apply")); $toapplylist = unserialize(file_get_contents('/tmp/.firewall_virtual_ip.apply'));
else } else {
$toapplylist = array(); $toapplylist = array();
}
$toapplylist[$id] = $a_vip[$id]; $toapplylist[$id] = $a_vip[$id];
if (!empty($a_vip[$id])) { if (!empty($a_vip[$id])) {
...@@ -228,7 +230,7 @@ if ($_POST) { ...@@ -228,7 +230,7 @@ if ($_POST) {
if (write_config()) { if (write_config()) {
mark_subsystem_dirty('vip'); mark_subsystem_dirty('vip');
file_put_contents("{$g['tmp_path']}/.firewall_virtual_ip.apply", serialize($toapplylist)); file_put_contents('/tmp/.firewall_virtual_ip.apply', serialize($toapplylist));
} }
header("Location: firewall_virtual_ip.php"); header("Location: firewall_virtual_ip.php");
exit; exit;
......
<?php <?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) Jim McBeath Copyright (C) Jim McBeath
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
...@@ -213,7 +213,7 @@ if (isset($_POST['add_x']) && isset($_POST['if_add'])) { ...@@ -213,7 +213,7 @@ if (isset($_POST['add_x']) && isset($_POST['if_add'])) {
uksort($config['interfaces'], "compare_interface_friendly_names"); uksort($config['interfaces'], "compare_interface_friendly_names");
/* XXX: Do not remove this. */ /* XXX: Do not remove this. */
unlink_if_exists("{$g['tmp_path']}/config.cache"); unlink_if_exists('/tmp/config.cache');
write_config(); write_config();
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Ermal Luçi Copyright (C) 2009 Ermal Luçi
...@@ -144,7 +145,7 @@ if ($_POST) { ...@@ -144,7 +145,7 @@ if ($_POST) {
$addmembers = array_diff($nmembers, $omembers); $addmembers = array_diff($nmembers, $omembers);
if ((count($delmembers) > 0) || (count($addmembers) > 0)) { if ((count($delmembers) > 0) || (count($addmembers) > 0)) {
$fd = fopen("{$g['tmp_path']}/netgraphcmd", "w"); $fd = fopen('/tmp/netgraphcmd', 'w');
foreach ($delmembers as $tag) { foreach ($delmembers as $tag) {
fwrite($fd, "shutdown {$qinqentry['vlanif']}h{$tag}:\n"); fwrite($fd, "shutdown {$qinqentry['vlanif']}h{$tag}:\n");
fwrite($fd, "msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"\n"); fwrite($fd, "msg {$qinqentry['vlanif']}qinq: delfilter \\\"{$qinqentry['vlanif']}{$tag}\\\"\n");
...@@ -159,7 +160,7 @@ if ($_POST) { ...@@ -159,7 +160,7 @@ if ($_POST) {
} }
fclose($fd); fclose($fd);
mwexec("/usr/sbin/ngctl -f {$g['tmp_path']}/netgraphcmd"); mwexec('/usr/sbin/ngctl -f /tmp/netgraphcmd');
} }
$a_qinqs[$id] = $qinqentry; $a_qinqs[$id] = $qinqentry;
} else { } else {
......
...@@ -59,25 +59,25 @@ if(is_subsystem_dirty('packagelock')) { ...@@ -59,25 +59,25 @@ if(is_subsystem_dirty('packagelock')) {
$pkg_cache_file_time=($g['min_pkg_cache_file_time'] ? $g['min_pkg_cache_file_time'] : 120); $pkg_cache_file_time=($g['min_pkg_cache_file_time'] ? $g['min_pkg_cache_file_time'] : 120);
$xmlrpc_base_url = get_active_xml_rpc_base_url(); $xmlrpc_base_url = get_active_xml_rpc_base_url();
if (!file_exists("{$g['tmp_path']}/pkg_info.cache") || (time() - filemtime("{$g['tmp_path']}/pkg_info.cache")) > $pkg_cache_file_time) { if (!file_exists('/tmp/pkg_info.cache') || (time() - filemtime('/tmp/pkg_info.cache')) > $pkg_cache_file_time) {
$pkg_info = get_pkg_info('all', array("noembedded", "name", "category", "website", "version", "status", "descr", "maintainer", "required_version", "maximum_version", "pkginfolink", "config_file")); $pkg_info = get_pkg_info('all', array("noembedded", "name", "category", "website", "version", "status", "descr", "maintainer", "required_version", "maximum_version", "pkginfolink", "config_file"));
//create cache file after get_pkg_info //create cache file after get_pkg_info
if($pkg_info) { if($pkg_info) {
$fout = fopen("{$g['tmp_path']}/pkg_info.cache", "w"); $fout = fopen('/tmp/pkg_info.cache', 'w');
fwrite($fout, serialize($pkg_info)); fwrite($fout, serialize($pkg_info));
fclose($fout); fclose($fout);
//$pkg_sizes = get_pkg_sizes(); //$pkg_sizes = get_pkg_sizes();
} else { } else {
$using_cache = true; $using_cache = true;
if(file_exists("{$g['tmp_path']}/pkg_info.cache")) { if (file_exists('/tmp/pkg_info.cache')) {
$savemsg = sprintf(gettext("Unable to retrieve package info from %s. Cached data will be used."), $xmlrpc_base_url); $savemsg = sprintf(gettext("Unable to retrieve package info from %s. Cached data will be used."), $xmlrpc_base_url);
$pkg_info = unserialize(@file_get_contents("{$g['tmp_path']}/pkg_info.cache")); $pkg_info = unserialize(@file_get_contents('/tmp/pkg_info.cache'));
} else { } else {
$savemsg = sprintf(gettext('Unable to communicate with %1$s. Please verify DNS and interface configuration, and that %2$s has functional Internet connectivity.'), $xmlrpc_base_url, $g['product_name']); $savemsg = sprintf(gettext('Unable to communicate with %1$s. Please verify DNS and interface configuration, and that %2$s has functional Internet connectivity.'), $xmlrpc_base_url, $g['product_name']);
} }
} }
} else { } else {
$pkg_info = unserialize(@file_get_contents("{$g['tmp_path']}/pkg_info.cache")); $pkg_info = unserialize(@file_get_contents('/tmp/pkg_info.cache'));
} }
if (! empty($_GET)) if (! empty($_GET))
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com> Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
...@@ -126,9 +127,9 @@ if ($_POST) { ...@@ -126,9 +127,9 @@ if ($_POST) {
write_config(); write_config();
$rules = captiveportal_allowedhostname_configure(); $rules = captiveportal_allowedhostname_configure();
@file_put_contents("{$g['tmp_path']}/hostname_rules", $rules); @file_put_contents('/tmp/hostname_rules', $rules);
$cpzoneid = $a_cp[$cpzone]['zoneid']; $cpzoneid = $a_cp[$cpzone]['zoneid'];
mwexec("/sbin/ipfw -x {$cpzoneid} {$g['tmp_path']}/hostname_rules"); mwexec("/sbin/ipfw -x {$cpzoneid} /tmp/hostname_rules");
unset($rules); unset($rules);
header("Location: services_captiveportal_hostname.php?zone={$cpzone}"); header("Location: services_captiveportal_hostname.php?zone={$cpzone}");
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com> Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
...@@ -37,11 +38,11 @@ function allowedips_sort() { ...@@ -37,11 +38,11 @@ function allowedips_sort() {
usort($config['captiveportal'][$cpzone]['allowedip'],"allowedipscmp"); usort($config['captiveportal'][$cpzone]['allowedip'],"allowedipscmp");
} }
require("guiconfig.inc"); require_once("guiconfig.inc");
require("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
require("shaper.inc"); require_once("shaper.inc");
require("captiveportal.inc"); require_once("captiveportal.inc");
$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit allowed IP address")); $pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit allowed IP address"));
$shortcut_section = "captiveportal"; $shortcut_section = "captiveportal";
...@@ -150,9 +151,9 @@ if ($_POST) { ...@@ -150,9 +151,9 @@ if ($_POST) {
captiveportal_free_dn_ruleno($ipfw['dnpipe']); captiveportal_free_dn_ruleno($ipfw['dnpipe']);
} }
$uniqid = uniqid("{$cpzone}_allowed"); $uniqid = uniqid("{$cpzone}_allowed");
@file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); @file_put_contents("/tmp/{$uniqid}_tmp", $rules);
mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); mwexec("/sbin/ipfw -x {$cpzoneid} -q /tmp/{$uniqid}_tmp");
@unlink("{$g['tmp_path']}/{$uniqid}_tmp"); @unlink("/tmp/{$uniqid}_tmp");
} }
header("Location: services_captiveportal_ip.php?zone={$cpzone}"); header("Location: services_captiveportal_ip.php?zone={$cpzone}");
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com> Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
...@@ -26,11 +27,11 @@ ...@@ -26,11 +27,11 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require("guiconfig.inc"); require_once("guiconfig.inc");
require("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
require("shaper.inc"); require_once("shaper.inc");
require("captiveportal.inc"); require_once("captiveportal.inc");
global $cpzone; global $cpzone;
global $cpzoneid; global $cpzoneid;
...@@ -96,9 +97,9 @@ if ($_POST) { ...@@ -96,9 +97,9 @@ if ($_POST) {
$cpzoneid = $a_cp[$cpzone]['zoneid']; $cpzoneid = $a_cp[$cpzone]['zoneid'];
$rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$idx]); $rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$idx]);
$uniqid = uniqid("{$cpzone}_mac"); $uniqid = uniqid("{$cpzone}_mac");
file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); file_put_contents("/tmp/{$uniqid}_tmp", $rules);
mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); mwexec("/sbin/ipfw -x {$cpzoneid} -q /tmp/{$uniqid}_tmp");
@unlink("{$g['tmp_path']}/{$uniqid}_tmp"); @unlink("/tmp/{$uniqid}_tmp");
unset($a_passthrumacs[$idx]); unset($a_passthrumacs[$idx]);
write_config(); write_config();
echo gettext("The entry was sucessfully deleted") . "\n"; echo gettext("The entry was sucessfully deleted") . "\n";
...@@ -115,9 +116,9 @@ if ($_GET['act'] == "del") { ...@@ -115,9 +116,9 @@ if ($_GET['act'] == "del") {
$cpzoneid = $a_cp[$cpzone]['zoneid']; $cpzoneid = $a_cp[$cpzone]['zoneid'];
$rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$_GET['id']]); $rules = captiveportal_passthrumac_delete_entry($a_passthrumacs[$_GET['id']]);
$uniqid = uniqid("{$cpzone}_mac"); $uniqid = uniqid("{$cpzone}_mac");
file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); file_put_contents("/tmp/{$uniqid}_tmp", $rules);
mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); mwexec("/sbin/ipfw -x {$cpzoneid} -q /tmp/{$uniqid}_tmp");
@unlink("{$g['tmp_path']}/{$uniqid}_tmp"); @unlink("/tmp/{$uniqid}_tmp");
unset($a_passthrumacs[$_GET['id']]); unset($a_passthrumacs[$_GET['id']]);
write_config(); write_config();
header("Location: services_captiveportal_mac.php?zone={$cpzone}"); header("Location: services_captiveportal_mac.php?zone={$cpzone}");
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com> Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
...@@ -36,11 +37,11 @@ function passthrumacs_sort() { ...@@ -36,11 +37,11 @@ function passthrumacs_sort() {
usort($config['captiveportal'][$cpzone]['passthrumac'],"passthrumacscmp"); usort($config['captiveportal'][$cpzone]['passthrumac'],"passthrumacscmp");
} }
require("guiconfig.inc"); require_once("guiconfig.inc");
require("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
require("shaper.inc"); require_once("shaper.inc");
require("captiveportal.inc"); require_once("captiveportal.inc");
global $cpzone; global $cpzone;
global $cpzoneid; global $cpzoneid;
...@@ -149,9 +150,9 @@ if ($_POST) { ...@@ -149,9 +150,9 @@ if ($_POST) {
$rules = captiveportal_passthrumac_delete_entry($oldmac); $rules = captiveportal_passthrumac_delete_entry($oldmac);
$rules .= captiveportal_passthrumac_configure_entry($mac); $rules .= captiveportal_passthrumac_configure_entry($mac);
$uniqid = uniqid("{$cpzone}_macedit"); $uniqid = uniqid("{$cpzone}_macedit");
file_put_contents("{$g['tmp_path']}/{$uniqid}_tmp", $rules); file_put_contents("/tmp/{$uniqid}_tmp", $rules);
mwexec("/sbin/ipfw -x {$cpzoneid} -q {$g['tmp_path']}/{$uniqid}_tmp"); mwexec("/sbin/ipfw -x {$cpzoneid} -q /tmp/{$uniqid}_tmp");
@unlink("{$g['tmp_path']}/{$uniqid}_tmp"); @unlink("/tmp/{$uniqid}_tmp");
unset($cpzoneid); unset($cpzoneid);
} }
......
...@@ -65,9 +65,9 @@ $pgtitle = array(gettext("System"),gettext("Firmware"),gettext("Settings")); ...@@ -65,9 +65,9 @@ $pgtitle = array(gettext("System"),gettext("Firmware"),gettext("Settings"));
$closehead = false; $closehead = false;
include("head.inc"); include("head.inc");
exec("/usr/bin/fetch -q -o {$g['tmp_path']}/manifest \"{$g['update_manifest']}\""); exec("/usr/bin/fetch -q -o /tmp/manifest \"{$g['update_manifest']}\"");
if(file_exists("{$g['tmp_path']}/manifest")) { if (file_exists('/tmp/manifest')) {
$preset_urls_split = explode("\n", file_get_contents("{$g['tmp_path']}/manifest")); $preset_urls_split = explode("\n", file_get_contents('/tmp/manifest'));
} }
?> ?>
......
<?php <?php
/* /*
Copyright (C) 2014-2015 Deciso B.V. Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>. Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
...@@ -26,7 +27,7 @@ ...@@ -26,7 +27,7 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
require("guiconfig.inc"); require_once("guiconfig.inc");
require_once("functions.inc"); require_once("functions.inc");
require_once("filter.inc"); require_once("filter.inc");
require_once("shaper.inc"); require_once("shaper.inc");
...@@ -46,12 +47,13 @@ if ($_POST) { ...@@ -46,12 +47,13 @@ if ($_POST) {
$retval = 0; $retval = 0;
if (file_exists("{$g['tmp_path']}/.system_routes.apply")) { if (file_exists('/tmp/.system_routes.apply')) {
$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply")); $toapplylist = unserialize(file_get_contents('/tmp/.system_routes.apply'));
foreach ($toapplylist as $toapply) foreach ($toapplylist as $toapply) {
mwexec("{$toapply}"); mwexec("{$toapply}");
}
@unlink("{$g['tmp_path']}/.system_routes.apply"); @unlink('/tmp/.system_routes.apply');
} }
$retval = system_routing_configure(); $retval = system_routing_configure();
......
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