Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
1f5d30b8
Commit
1f5d30b8
authored
Mar 12, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: tmp_path gone with the wind
parent
ad334c80
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
68 additions
and
68 deletions
+68
-68
firewall_aliases_edit.php
src/www/firewall_aliases_edit.php
+6
-15
firewall_virtual_ip.php
src/www/firewall_virtual_ip.php
+3
-3
firewall_virtual_ip_edit.php
src/www/firewall_virtual_ip_edit.php
+9
-7
interfaces_assign.php
src/www/interfaces_assign.php
+2
-2
interfaces_qinq_edit.php
src/www/interfaces_qinq_edit.php
+3
-2
pkg_mgr.php
src/www/pkg_mgr.php
+5
-5
services_captiveportal_hostname_edit.php
src/www/services_captiveportal_hostname_edit.php
+3
-2
services_captiveportal_ip_edit.php
src/www/services_captiveportal_ip_edit.php
+8
-7
services_captiveportal_mac.php
src/www/services_captiveportal_mac.php
+11
-10
services_captiveportal_mac_edit.php
src/www/services_captiveportal_mac_edit.php
+8
-7
system_firmware_settings.php
src/www/system_firmware_settings.php
+3
-3
system_routes.php
src/www/system_routes.php
+7
-5
No files found.
src/www/firewall_aliases_edit.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2004 Scott Ullrich
...
...
@@ -28,19 +29,8 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
pfSense_BUILDER_BINARIES: /bin/rm /bin/mkdir /usr/bin/fetch
pfSense_MODULE: aliases
*/
##|+PRIV
##|*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
(
"guiconfig.inc"
);
require_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
require_once
(
"shaper.inc"
);
...
...
@@ -70,8 +60,9 @@ if($_POST)
$origname
=
$_POST
[
'origname'
];
// Debugging
if
(
$debug
)
unlink_if_exists
(
"
{
$g
[
'tmp_path'
]
}
/alias_rename_log.txt"
);
if
(
$debug
)
{
unlink_if_exists
(
'/tmp/alias_rename_log.txt'
);
}
function
alias_same_type
(
$name
,
$type
)
{
global
$config
;
...
...
@@ -203,7 +194,7 @@ if ($_POST) {
if
(
$_POST
[
'address'
.
$x
])
{
/* fetch down and add in */
$isfirst
=
0
;
$temp_filename
=
tempnam
(
"
{
$g
[
'tmp_path'
]
}
/"
,
"alias_import"
);
$temp_filename
=
tempnam
(
'/tmp/'
,
'alias_import'
);
unlink_if_exists
(
$temp_filename
);
$verify_ssl
=
isset
(
$config
[
'system'
][
'checkaliasesurlcert'
]);
mkdir
(
$temp_filename
);
...
...
src/www/firewall_virtual_ip.php
View file @
1f5d30b8
...
...
@@ -43,8 +43,8 @@ if ($_POST) {
$pconfig
=
$_POST
;
if
(
$_POST
[
'apply'
])
{
if
(
file_exists
(
"
{
$g
[
'tmp_path'
]
}
/.firewall_virtual_ip.apply"
))
{
$toapplylist
=
unserialize
(
file_get_contents
(
"
{
$g
[
'tmp_path'
]
}
/.firewall_virtual_ip.apply"
));
if
(
file_exists
(
'/tmp/.firewall_virtual_ip.apply'
))
{
$toapplylist
=
unserialize
(
file_get_contents
(
'/tmp/.firewall_virtual_ip.apply'
));
foreach
(
$toapplylist
as
$vid
=>
$ovip
)
{
if
(
!
empty
(
$ovip
))
interface_vip_bring_down
(
$ovip
);
...
...
@@ -64,7 +64,7 @@ if ($_POST) {
}
}
}
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/.firewall_virtual_ip.apply"
);
@
unlink
(
'/tmp/.firewall_virtual_ip.apply'
);
}
$retval
=
0
;
$retval
|=
filter_configure
();
...
...
src/www/firewall_virtual_ip_edit.php
View file @
1f5d30b8
<?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) 2003-2005 Manuel Kasper <mk@neon1.net>.
Copyright (C) 2004-2005 Scott Ullrich <geekgod@pfsense.com>.
...
...
@@ -28,9 +29,9 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require
(
"guiconfig.inc"
);
require
_once
(
"guiconfig.inc"
);
require_once
(
"filter.inc"
);
require
(
"shaper.inc"
);
require
_once
(
"shaper.inc"
);
$referer
=
(
isset
(
$_SERVER
[
'HTTP_REFERER'
])
?
$_SERVER
[
'HTTP_REFERER'
]
:
'/firewall_virtual_ip.php'
);
...
...
@@ -211,10 +212,11 @@ if ($_POST) {
if
(
!
isset
(
$id
))
$id
=
count
(
$a_vip
);
if
(
file_exists
(
"
{
$g
[
'tmp_path'
]
}
/.firewall_virtual_ip.apply"
))
$toapplylist
=
unserialize
(
file_get_contents
(
"
{
$g
[
'tmp_path'
]
}
/.firewall_virtual_ip.apply"
));
else
if
(
file_exists
(
'/tmp/.firewall_virtual_ip.apply'
))
{
$toapplylist
=
unserialize
(
file_get_contents
(
'/tmp/.firewall_virtual_ip.apply'
));
}
else
{
$toapplylist
=
array
();
}
$toapplylist
[
$id
]
=
$a_vip
[
$id
];
if
(
!
empty
(
$a_vip
[
$id
]))
{
...
...
@@ -228,7 +230,7 @@ if ($_POST) {
if
(
write_config
())
{
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"
);
exit
;
...
...
src/www/interfaces_assign.php
View file @
1f5d30b8
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) Jim McBeath
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
...
...
@@ -213,7 +213,7 @@ if (isset($_POST['add_x']) && isset($_POST['if_add'])) {
uksort
(
$config
[
'interfaces'
],
"compare_interface_friendly_names"
);
/* XXX: Do not remove this. */
unlink_if_exists
(
"
{
$g
[
'tmp_path'
]
}
/config.cache"
);
unlink_if_exists
(
'/tmp/config.cache'
);
write_config
();
...
...
src/www/interfaces_qinq_edit.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2009 Ermal Luçi
...
...
@@ -144,7 +145,7 @@ if ($_POST) {
$addmembers
=
array_diff
(
$nmembers
,
$omembers
);
if
((
count
(
$delmembers
)
>
0
)
||
(
count
(
$addmembers
)
>
0
))
{
$fd
=
fopen
(
"
{
$g
[
'tmp_path'
]
}
/netgraphcmd"
,
"w"
);
$fd
=
fopen
(
'/tmp/netgraphcmd'
,
'w'
);
foreach
(
$delmembers
as
$tag
)
{
fwrite
(
$fd
,
"shutdown
{
$qinqentry
[
'vlanif'
]
}
h
{
$tag
}
:
\n
"
);
fwrite
(
$fd
,
"msg
{
$qinqentry
[
'vlanif'
]
}
qinq: delfilter
\\\"
{
$qinqentry
[
'vlanif'
]
}{
$tag
}
\\\"\n
"
);
...
...
@@ -159,7 +160,7 @@ if ($_POST) {
}
fclose
(
$fd
);
mwexec
(
"/usr/sbin/ngctl -f
{
$g
[
'tmp_path'
]
}
/netgraphcmd"
);
mwexec
(
'/usr/sbin/ngctl -f /tmp/netgraphcmd'
);
}
$a_qinqs
[
$id
]
=
$qinqentry
;
}
else
{
...
...
src/www/pkg_mgr.php
View file @
1f5d30b8
...
...
@@ -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
);
$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"
));
//create cache file after get_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
));
fclose
(
$fout
);
//$pkg_sizes = get_pkg_sizes();
}
else
{
$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
);
$pkg_info
=
unserialize
(
@
file_get_contents
(
"
{
$g
[
'tmp_path'
]
}
/pkg_info.cache"
));
$pkg_info
=
unserialize
(
@
file_get_contents
(
'/tmp/pkg_info.cache'
));
}
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'
]);
}
}
}
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
))
...
...
src/www/services_captiveportal_hostname_edit.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
...
...
@@ -126,9 +127,9 @@ if ($_POST) {
write_config
();
$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'
];
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
{
$g
[
'tmp_path'
]
}
/hostname_rules"
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
/tmp
/hostname_rules"
);
unset
(
$rules
);
header
(
"Location: services_captiveportal_hostname.php?zone=
{
$cpzone
}
"
);
...
...
src/www/services_captiveportal_ip_edit.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2011 Scott Ullrich <sullrich@gmail.com>
...
...
@@ -37,11 +38,11 @@ function allowedips_sort() {
usort
(
$config
[
'captiveportal'
][
$cpzone
][
'allowedip'
],
"allowedipscmp"
);
}
require
(
"guiconfig.inc"
);
require
(
"functions.inc"
);
require
_once
(
"guiconfig.inc"
);
require
_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
require
(
"shaper.inc"
);
require
(
"captiveportal.inc"
);
require
_once
(
"shaper.inc"
);
require
_once
(
"captiveportal.inc"
);
$pgtitle
=
array
(
gettext
(
"Services"
),
gettext
(
"Captive portal"
),
gettext
(
"Edit allowed IP address"
));
$shortcut_section
=
"captiveportal"
;
...
...
@@ -150,9 +151,9 @@ if ($_POST) {
captiveportal_free_dn_ruleno
(
$ipfw
[
'dnpipe'
]);
}
$uniqid
=
uniqid
(
"
{
$cpzone
}
_allowed"
);
@
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
@
file_put_contents
(
"
/tmp
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
/tmp
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
/tmp
/
{
$uniqid
}
_tmp"
);
}
header
(
"Location: services_captiveportal_ip.php?zone=
{
$cpzone
}
"
);
...
...
src/www/services_captiveportal_mac.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
...
...
@@ -26,11 +27,11 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require
(
"guiconfig.inc"
);
require
(
"functions.inc"
);
require
_once
(
"guiconfig.inc"
);
require
_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
require
(
"shaper.inc"
);
require
(
"captiveportal.inc"
);
require
_once
(
"shaper.inc"
);
require
_once
(
"captiveportal.inc"
);
global
$cpzone
;
global
$cpzoneid
;
...
...
@@ -96,9 +97,9 @@ if ($_POST) {
$cpzoneid
=
$a_cp
[
$cpzone
][
'zoneid'
];
$rules
=
captiveportal_passthrumac_delete_entry
(
$a_passthrumacs
[
$idx
]);
$uniqid
=
uniqid
(
"
{
$cpzone
}
_mac"
);
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
file_put_contents
(
"
/tmp
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
/tmp
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
/tmp
/
{
$uniqid
}
_tmp"
);
unset
(
$a_passthrumacs
[
$idx
]);
write_config
();
echo
gettext
(
"The entry was sucessfully deleted"
)
.
"
\n
"
;
...
...
@@ -115,9 +116,9 @@ if ($_GET['act'] == "del") {
$cpzoneid
=
$a_cp
[
$cpzone
][
'zoneid'
];
$rules
=
captiveportal_passthrumac_delete_entry
(
$a_passthrumacs
[
$_GET
[
'id'
]]);
$uniqid
=
uniqid
(
"
{
$cpzone
}
_mac"
);
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
file_put_contents
(
"
/tmp
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
/tmp
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
/tmp
/
{
$uniqid
}
_tmp"
);
unset
(
$a_passthrumacs
[
$_GET
[
'id'
]]);
write_config
();
header
(
"Location: services_captiveportal_mac.php?zone=
{
$cpzone
}
"
);
...
...
src/www/services_captiveportal_mac_edit.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2004 Dinesh Nair <dinesh@alphaque.com>
...
...
@@ -36,11 +37,11 @@ function passthrumacs_sort() {
usort
(
$config
[
'captiveportal'
][
$cpzone
][
'passthrumac'
],
"passthrumacscmp"
);
}
require
(
"guiconfig.inc"
);
require
(
"functions.inc"
);
require
_once
(
"guiconfig.inc"
);
require
_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
require
(
"shaper.inc"
);
require
(
"captiveportal.inc"
);
require
_once
(
"shaper.inc"
);
require
_once
(
"captiveportal.inc"
);
global
$cpzone
;
global
$cpzoneid
;
...
...
@@ -149,9 +150,9 @@ if ($_POST) {
$rules
=
captiveportal_passthrumac_delete_entry
(
$oldmac
);
$rules
.=
captiveportal_passthrumac_configure_entry
(
$mac
);
$uniqid
=
uniqid
(
"
{
$cpzone
}
_macedit"
);
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/
{
$uniqid
}
_tmp"
);
file_put_contents
(
"
/tmp
/
{
$uniqid
}
_tmp"
,
$rules
);
mwexec
(
"/sbin/ipfw -x
{
$cpzoneid
}
-q
/tmp
/
{
$uniqid
}
_tmp"
);
@
unlink
(
"
/tmp
/
{
$uniqid
}
_tmp"
);
unset
(
$cpzoneid
);
}
...
...
src/www/system_firmware_settings.php
View file @
1f5d30b8
...
...
@@ -65,9 +65,9 @@ $pgtitle = array(gettext("System"),gettext("Firmware"),gettext("Settings"));
$closehead
=
false
;
include
(
"head.inc"
);
exec
(
"/usr/bin/fetch -q -o
{
$g
[
'tmp_path'
]
}
/manifest
\"
{
$g
[
'update_manifest'
]
}
\"
"
);
if
(
file_exists
(
"
{
$g
[
'tmp_path'
]
}
/manifest"
))
{
$preset_urls_split
=
explode
(
"
\n
"
,
file_get_contents
(
"
{
$g
[
'tmp_path'
]
}
/manifest"
));
exec
(
"/usr/bin/fetch -q -o
/tmp
/manifest
\"
{
$g
[
'update_manifest'
]
}
\"
"
);
if
(
file_exists
(
'/tmp/manifest'
))
{
$preset_urls_split
=
explode
(
"
\n
"
,
file_get_contents
(
'/tmp/manifest'
));
}
?>
...
...
src/www/system_routes.php
View file @
1f5d30b8
<?php
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
...
...
@@ -26,7 +27,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
require
(
"guiconfig.inc"
);
require
_once
(
"guiconfig.inc"
);
require_once
(
"functions.inc"
);
require_once
(
"filter.inc"
);
require_once
(
"shaper.inc"
);
...
...
@@ -46,12 +47,13 @@ if ($_POST) {
$retval
=
0
;
if
(
file_exists
(
"
{
$g
[
'tmp_path'
]
}
/.system_routes.apply"
))
{
$toapplylist
=
unserialize
(
file_get_contents
(
"
{
$g
[
'tmp_path'
]
}
/.system_routes.apply"
));
foreach
(
$toapplylist
as
$toapply
)
if
(
file_exists
(
'/tmp/.system_routes.apply'
))
{
$toapplylist
=
unserialize
(
file_get_contents
(
'/tmp/.system_routes.apply'
));
foreach
(
$toapplylist
as
$toapply
)
{
mwexec
(
"
{
$toapply
}
"
);
}
@
unlink
(
"
{
$g
[
'tmp_path'
]
}
/.system_routes.apply"
);
@
unlink
(
'/tmp/.system_routes.apply'
);
}
$retval
=
system_routing_configure
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment