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
d90e3a5e
Commit
d90e3a5e
authored
Mar 05, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
inc: tmp_path removal in smaller files
parent
7fd322f1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
36 deletions
+37
-36
legacy.inc
src/etc/inc/legacy.inc
+3
-3
shaper.inc
src/etc/inc/shaper.inc
+6
-10
vslb.inc
src/etc/inc/vslb.inc
+23
-13
xmlparse_attr.inc
src/etc/inc/xmlparse_attr.inc
+5
-10
No files found.
src/etc/inc/legacy.inc
View file @
d90e3a5e
...
...
@@ -1229,7 +1229,7 @@ function get_interface_info($ifdescr) {
$usbmodemoutput
=
array
();
exec
(
"usbconfig"
,
$usbmodemoutput
);
$mondev
=
"
{
$g
[
'tmp_path'
]
}
/3gstats.
{
$ifdescr
}
"
;
$mondev
=
"
/tmp
/3gstats.
{
$ifdescr
}
"
;
if
(
file_exists
(
$mondev
))
{
$cellstats
=
file
(
$mondev
);
/* skip header */
...
...
@@ -1753,7 +1753,7 @@ function update_alias_names_upon_change($section, $field, $new_alias_name, $orig
return
;
}
if
(
$debug
)
$fd
=
fopen
(
"
{
$g
[
'tmp_path'
]
}
/print_r"
,
"a"
);
if
(
$debug
)
$fd
=
fopen
(
'/tmp/print_r'
,
'a'
);
if
(
$debug
)
fwrite
(
$fd
,
print_r
(
$pconfig
,
true
));
if
(
is_array
(
$sectionref
))
{
...
...
@@ -1797,7 +1797,7 @@ function update_alias_url_data() {
$isfirst
=
0
;
foreach
(
$alias
[
'aliasurl'
]
as
$alias_url
)
{
/* fetch down and add in */
$temp_filename
=
tempnam
(
"
{
$g
[
'tmp_path'
]
}
/"
,
"alias_import"
);
$temp_filename
=
tempnam
(
'/tmp/'
,
'alias_import'
);
unlink
(
$temp_filename
);
$verify_ssl
=
isset
(
$config
[
'system'
][
'checkaliasesurlcert'
]);
mkdir
(
$temp_filename
);
...
...
src/etc/inc/shaper.inc
View file @
d90e3a5e
<?php
/*
Copyright (C) 2008 Ermal Luçi
All rights reserved.
...
...
@@ -23,13 +24,8 @@
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
pfSense_BUILDER_BINARIES: /bin/kill /sbin/kldload /bin/rm /bin/ps
pfSense_MODULE: shaper
*/
/* XXX: needs some reducing on include. */
/* include all configuration functions. */
require_once
(
"globals.inc"
);
require_once
(
"functions.inc"
);
require_once
(
"util.inc"
);
...
...
@@ -4106,7 +4102,7 @@ function generate_layer7_files() {
if
(
!
is_module_loaded
(
"ipdivert.ko"
))
mwexec
(
"/sbin/kldload ipdivert.ko"
);
array_map
(
'unlink'
,
glob
(
"
{
$g
[
'tmp_path'
]
}
/*.l7"
));
array_map
(
'unlink'
,
glob
(
'/tmp/*.l7'
));
}
update_layer7_custom_patterns
();
...
...
@@ -4114,7 +4110,7 @@ function generate_layer7_files() {
foreach
(
$layer7_rules_list
as
$l7rules
)
{
if
(
$l7rules
->
GetREnabled
())
{
$filename
=
$l7rules
->
GetRName
()
.
".l7"
;
$path
=
"
{
$g
[
'tmp_path'
]
}
/"
.
$filename
;
$path
=
'/tmp/'
.
$filename
;
$rules
=
$l7rules
->
build_l7_rules
();
...
...
@@ -4136,7 +4132,7 @@ function layer7_start_l7daemon() {
foreach
(
$layer7_rules_list
as
$l7rules
)
{
if
(
$l7rules
->
GetREnabled
())
{
$filename
=
$l7rules
->
GetRName
()
.
".l7"
;
$path
=
"
{
$g
[
'tmp_path'
]
}
/"
.
$filename
;
$path
=
'/tmp/'
.
$filename
;
unset
(
$l7pid
);
/* Only reread the configuration rather than restart to avoid losing information. */
...
...
@@ -4484,8 +4480,8 @@ return;
"net.inet.ip.dummynet.hash_size"
=>
"256"
));
}
file_put_contents
(
"
{
$g
[
'tmp_path'
]
}
/rules.limiter"
,
$dn_rules
);
mwexec
(
"/sbin/ipfw
{
$g
[
'tmp_path'
]
}
/rules.limiter"
);
file_put_contents
(
'/tmp/rules.limiter'
,
$dn_rules
);
mwexec
(
'/sbin/ipfw /tmp/rules.limiter'
);
}
}
...
...
src/etc/inc/vslb.inc
View file @
d90e3a5e
...
...
@@ -499,41 +499,52 @@ function cleanup_lb_anchor($anchorname = "*") {
}
/* Mark an anchor for later cleanup. This will allow us to remove an old VS name */
function
cleanup_lb_mark_anchor
(
$name
)
{
global
$g
;
function
cleanup_lb_mark_anchor
(
$name
)
{
/* Nothing to do! */
if
(
empty
(
$name
))
if
(
empty
(
$name
))
{
return
;
$filename
=
"
{
$g
[
'tmp_path'
]
}
/relayd_anchors_remove"
;
}
$filename
=
'/tmp/relayd_anchors_remove'
;
$cleanup_anchors
=
array
();
/* Read in any currently unapplied name changes */
if
(
file_exists
(
$filename
))
if
(
file_exists
(
$filename
))
{
$cleanup_anchors
=
explode
(
"
\n
"
,
file_get_contents
(
$filename
));
}
/* Only add the anchor to the list if it's not already there. */
if
(
!
in_array
(
$name
,
$cleanup_anchors
))
if
(
!
in_array
(
$name
,
$cleanup_anchors
))
{
$cleanup_anchors
[]
=
$name
;
}
file_put_contents
(
$filename
,
implode
(
"
\n
"
,
$cleanup_anchors
));
}
/* Cleanup relayd anchors that have been marked for cleanup. */
function
cleanup_lb_marked
()
{
global
$g
,
$config
;
$filename
=
"
{
$g
[
'tmp_path'
]
}
/relayd_anchors_remove"
;
function
cleanup_lb_marked
()
{
global
$config
;
$filename
=
'/tmp/relayd_anchors_remove'
;
$cleanup_anchors
=
array
();
/* Nothing to do! */
if
(
!
file_exists
(
$filename
))
{
return
;
}
else
{
$cleanup_anchors
=
explode
(
"
\n
"
,
file_get_contents
(
$filename
));
/* Nothing to do! */
if
(
empty
(
$cleanup_anchors
))
if
(
empty
(
$cleanup_anchors
))
{
return
;
}
}
/* Load current names so we can make sure we don't remove an anchor that is still in use. */
$vs_a
=
$config
[
'load_balancer'
][
'virtual_server'
];
$active_vsnames
=
array
();
if
(
is_array
(
$vs_a
))
{
if
(
isset
(
$vs_a
))
{
foreach
(
$vs_a
as
$vs
)
{
$active_vsnames
[]
=
$vs
[
'name'
];
}
...
...
@@ -545,7 +556,6 @@ function cleanup_lb_marked() {
cleanup_lb_anchor
(
$anchor
);
}
}
unlink_if_exists
(
$filename
);
}
?>
src/etc/inc/xmlparse_attr.inc
View file @
d90e3a5e
<?php
/* $Id$ */
/*
xmlparse_attr.inc
functions to parse configuration files in XML format with attributes
Copyright (C) 2010 Erik Fonnesbeck
All rights reserved.
Based on xmlparse.inc, originally part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
All rights reserved.
...
...
@@ -129,7 +124,7 @@ function cData_attr($parser, $data) {
function
parse_xml_regdomain
(
&
$rdattributes
,
$rdfile
=
''
,
$rootobj
=
'regulatory-data'
)
{
global
$
g
,
$
listtags
;
global
$listtags
;
if
(
empty
(
$rdfile
))
{
$rdfile
=
'/etc/regdomain.xml'
;
...
...
@@ -138,8 +133,8 @@ function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulator
$listtags
=
listtags_rd
();
$parsed_xml
=
array
();
if
(
file_exists
(
$g
[
'tmp_path'
]
.
'
/regdomain.cache'
))
{
$parsed_xml
=
unserialize
(
file_get_contents
(
$g
[
'tmp_path'
]
.
'
/regdomain.cache'
));
if
(
file_exists
(
'/tmp
/regdomain.cache'
))
{
$parsed_xml
=
unserialize
(
file_get_contents
(
'/tmp
/regdomain.cache'
));
if
(
!
empty
(
$parsed_xml
))
{
$rdmain
=
$parsed_xml
[
'main'
];
$rdattributes
=
$parsed_xml
[
'attributes'
];
...
...
@@ -161,7 +156,7 @@ function parse_xml_regdomain(&$rdattributes, $rdfile = '', $rootobj = 'regulator
unset
(
$rdattributes
[
'shared-frequency-bands'
]);
$parsed_xml
=
array
(
'main'
=>
$rdmain
,
'attributes'
=>
$rdattributes
);
$rdcache
=
fopen
(
$g
[
'tmp_path'
]
.
'/regdomain.cache'
,
"w"
);
$rdcache
=
fopen
(
'/tmp/regdomain.cache'
,
'w'
);
fwrite
(
$rdcache
,
serialize
(
$parsed_xml
));
fclose
(
$rdcache
);
}
...
...
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