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
1df84c3e
Commit
1df84c3e
authored
Feb 19, 2017
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(filter) ditch alias_get_type()
parent
91de2057
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
19 deletions
+3
-19
filter.inc
src/etc/inc/filter.inc
+2
-3
util.inc
src/etc/inc/util.inc
+0
-15
rc.update_urltables
src/etc/rc.update_urltables
+1
-1
No files found.
src/etc/inc/filter.inc
View file @
1df84c3e
...
...
@@ -46,7 +46,7 @@ function alias_expand_urltable($name) {
if
(
preg_match
(
"/urltable/i"
,
$alias
[
'type'
])
&&
(
$alias
[
'name'
]
==
$name
))
{
if
(
is_URL
(
$alias
[
"url"
])
&&
file_exists
(
$urltable_filename
)
&&
filesize
(
$urltable_filename
))
{
return
$urltable_filename
;
}
elseif
(
process_alias_urltable
(
$name
,
$alias
[
"url"
],
0
,
true
))
{
}
elseif
(
process_alias_urltable
(
$name
,
$alias
[
"
type"
],
$alias
[
"
url"
],
0
,
true
))
{
return
$urltable_filename
;
}
}
elseif
(
$alias
[
'type'
]
==
'geoip'
&&
$alias
[
'name'
]
==
$name
)
{
...
...
@@ -185,7 +185,7 @@ function update_alias_names_upon_change($section, $field, $new_alias_name, $orig
}
}
function
process_alias_urltable
(
$name
,
$url
,
$freq
,
$forceupdate
=
false
)
function
process_alias_urltable
(
$name
,
$
alias_type
,
$
url
,
$freq
,
$forceupdate
=
false
)
{
global
$config
;
...
...
@@ -211,7 +211,6 @@ function process_alias_urltable($name, $url, $freq, $forceupdate = false)
// todo: rethink alias_expand_urltable in filter.inc , its probably not a very good idea to download and
// process files during boot.
$output_file_handle
=
fopen
(
$urltable_filename
,
'w'
);
$alias_type
=
alias_get_type
(
$name
);
// Try to fetch the URL supplied
@
unlink
(
"
{
$urltable_filename
}
.tmp"
);
$verify_ssl
=
isset
(
$config
[
'system'
][
'checkaliasesurlcert'
]);
...
...
src/etc/inc/util.inc
View file @
1df84c3e
...
...
@@ -1088,21 +1088,6 @@ function is_alias($name)
return
array_key_exists
(
$name
,
$aliastable
);
}
function
alias_get_type
(
$name
)
{
global
$config
;
if
(
is_array
(
$config
[
'aliases'
][
'alias'
]))
{
foreach
(
$config
[
'aliases'
][
'alias'
]
as
$alias
)
{
if
(
$name
==
$alias
[
'name'
])
{
return
$alias
[
'type'
];
}
}
}
return
""
;
}
/* expand a host or network alias, if necessary */
function
alias_expand
(
$name
)
{
...
...
src/etc/rc.update_urltables
View file @
1df84c3e
...
...
@@ -36,7 +36,7 @@ if (count($todo) > 0) {
foreach
(
$todo
as
$alias
)
{
if
(
preg_match
(
'/urltable/i'
,
$alias
[
'type'
]))
{
log_error
(
"
{
$argv
[
0
]
}
: start update
{
$alias
[
'name'
]
}
"
);
$r
=
process_alias_urltable
(
$alias
[
'name'
],
$alias
[
'url'
],
$alias
[
'updatefreq'
]);
$r
=
process_alias_urltable
(
$alias
[
'name'
],
$alias
[
'
type'
],
$alias
[
'
url'
],
$alias
[
'updatefreq'
]);
if
(
$r
==
1
)
{
if
(
$alias
[
'type'
]
==
"urltable"
)
{
exec
(
"/sbin/pfctl -t "
.
escapeshellarg
(
$alias
[
'name'
])
.
" -T replace -f /var/db/aliastables/"
.
escapeshellarg
(
$alias
[
'name'
])
.
".txt 2>&1"
,
$result
);
...
...
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