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
6ca40bc4
Commit
6ca40bc4
authored
Mar 17, 2017
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mvc: new style checker has new style checks ;)
parent
9821d6fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
71 deletions
+69
-71
FilterRule.php
...opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php
+1
-1
Util.php
src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php
+68
-69
AuthGroupField.php
...vc/app/models/OPNsense/Base/FieldTypes/AuthGroupField.php
+0
-1
No files found.
src/opnsense/mvc/app/library/OPNsense/Firewall/FilterRule.php
View file @
6ca40bc4
...
@@ -314,7 +314,7 @@ class FilterRule
...
@@ -314,7 +314,7 @@ class FilterRule
// set prio
// set prio
if
(
isset
(
$tmp
[
'set-prio'
])
&&
$tmp
[
'set-prio'
]
!==
""
if
(
isset
(
$tmp
[
'set-prio'
])
&&
$tmp
[
'set-prio'
]
!==
""
&&
isset
(
$tmp
[
'set-prio-low'
])
&&
$tmp
[
'set-prio-low'
]
!==
""
)
{
&&
isset
(
$tmp
[
'set-prio-low'
])
&&
$tmp
[
'set-prio-low'
]
!==
""
)
{
$tmp
[
'set-prio'
]
=
"(
{
$tmp
[
'set-prio'
]
}
,
{
$tmp
[
'set-prio-low'
]
}
)"
;
$tmp
[
'set-prio'
]
=
"(
{
$tmp
[
'set-prio'
]
}
,
{
$tmp
[
'set-prio-low'
]
}
)"
;
}
}
$result
[]
=
$tmp
;
$result
[]
=
$tmp
;
}
}
...
...
src/opnsense/mvc/app/library/OPNsense/Firewall/Util.php
View file @
6ca40bc4
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
/**
/**
* Copyright (C) 2017 Deciso B.V.
* Copyright (C) 2017 Deciso B.V.
*
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
...
@@ -37,75 +36,75 @@ use \OPNsense\Core\Config;
...
@@ -37,75 +36,75 @@ use \OPNsense\Core\Config;
*/
*/
class
Util
class
Util
{
{
/**
/**
* is provided address an ip address.
* is provided address an ip address.
* @param string $network address
* @param string $network address
* @return boolean
* @return boolean
*/
*/
public
static
function
isIpAddress
(
$address
)
public
static
function
isIpAddress
(
$address
)
{
{
return
!
empty
(
filter_var
(
$address
,
FILTER_VALIDATE_IP
));
return
!
empty
(
filter_var
(
$address
,
FILTER_VALIDATE_IP
));
}
}
/**
/**
* is provided network valid
* is provided network valid
* @param string $network network
* @param string $network network
* @return boolean
* @return boolean
*/
*/
public
static
function
isSubnet
(
$network
)
public
static
function
isSubnet
(
$network
)
{
{
$tmp
=
explode
(
'/'
,
$network
);
$tmp
=
explode
(
'/'
,
$network
);
if
(
count
(
$tmp
)
==
2
)
{
if
(
count
(
$tmp
)
==
2
)
{
if
(
self
::
isIpAddress
(
$tmp
[
0
])
&&
abs
(
$tmp
[
1
])
==
$tmp
[
1
])
{
if
(
self
::
isIpAddress
(
$tmp
[
0
])
&&
abs
(
$tmp
[
1
])
==
$tmp
[
1
])
{
if
(
strpos
(
$tmp
[
0
],
':'
)
!==
false
&&
$tmp
[
1
]
<=
128
)
{
if
(
strpos
(
$tmp
[
0
],
':'
)
!==
false
&&
$tmp
[
1
]
<=
128
)
{
// subnet v6
// subnet v6
return
true
;
return
true
;
}
elseif
(
$tmp
[
1
]
<=
32
)
{
}
elseif
(
$tmp
[
1
]
<=
32
)
{
// subnet v4
// subnet v4
return
true
;
return
true
;
}
}
}
}
}
}
return
false
;
return
false
;
}
}
/**
/**
* check if name exists in alias config section
* check if name exists in alias config section
* @param string $name name
* @param string $name name
* @return boolean
* @return boolean
*/
*/
public
static
function
isAlias
(
$name
)
public
static
function
isAlias
(
$name
)
{
{
if
(
!
empty
(
Config
::
getInstance
()
->
object
()
->
aliases
))
{
if
(
!
empty
(
Config
::
getInstance
()
->
object
()
->
aliases
))
{
foreach
(
Config
::
getInstance
()
->
object
()
->
aliases
->
children
()
as
$node
)
{
foreach
(
Config
::
getInstance
()
->
object
()
->
aliases
->
children
()
as
$node
)
{
if
(
$node
->
name
==
$name
)
{
if
(
$node
->
name
==
$name
)
{
return
true
;
return
true
;
}
}
}
}
}
}
return
false
;
return
false
;
}
}
/**
/**
* check if name exists in alias config section
* check if name exists in alias config section
* @param string $number port number or range
* @param string $number port number or range
* @param boolean $allow_range ranges allowed
* @param boolean $allow_range ranges allowed
* @return boolean
* @return boolean
*/
*/
public
function
isPort
(
$number
,
$allow_range
=
true
)
public
function
isPort
(
$number
,
$allow_range
=
true
)
{
{
$tmp
=
explode
(
':'
,
$number
);
$tmp
=
explode
(
':'
,
$number
);
foreach
(
$tmp
as
$port
)
{
foreach
(
$tmp
as
$port
)
{
if
(
!
getservbyname
(
$port
,
"tcp"
)
&&
!
getservbyname
(
$port
,
"udp"
)
if
(
!
getservbyname
(
$port
,
"tcp"
)
&&
!
getservbyname
(
$port
,
"udp"
)
&&
filter_var
(
$port
,
FILTER_VALIDATE_INT
,
array
(
&&
filter_var
(
$port
,
FILTER_VALIDATE_INT
,
array
(
"options"
=>
array
(
"min_range"
=>
1
,
"max_range"
=>
65535
)))
===
false
"options"
=>
array
(
"min_range"
=>
1
,
"max_range"
=>
65535
)))
===
false
)
{
)
{
return
false
;
return
false
;
}
}
}
}
if
((
$allow_range
&&
count
(
$tmp
)
<=
2
)
||
count
(
$tmp
)
==
1
)
{
if
((
$allow_range
&&
count
(
$tmp
)
<=
2
)
||
count
(
$tmp
)
==
1
)
{
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
}
}
src/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/AuthGroupField.php
View file @
6ca40bc4
...
@@ -33,7 +33,6 @@ use Phalcon\Validation\Validator\InclusionIn;
...
@@ -33,7 +33,6 @@ use Phalcon\Validation\Validator\InclusionIn;
use
OPNsense\Base\Validators\CsvListValidator
;
use
OPNsense\Base\Validators\CsvListValidator
;
use
OPNsense\Core\Config
;
use
OPNsense\Core\Config
;
class
AuthGroupField
extends
BaseField
class
AuthGroupField
extends
BaseField
{
{
/**
/**
...
...
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