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
936dead8
Commit
936dead8
authored
Feb 16, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dns: some style and sanity for dnydnses and dnsupdates gears
parent
97cac62f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
21 deletions
+30
-21
auth.inc
src/etc/inc/auth.inc
+21
-14
openvpn-client-export.inc
src/etc/inc/openvpn-client-export.inc
+7
-4
services.inc
src/etc/inc/services.inc
+1
-3
diag_backup.php
src/www/diag_backup.php
+1
-0
No files found.
src/etc/inc/auth.inc
View file @
936dead8
...
@@ -70,27 +70,30 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
...
@@ -70,27 +70,30 @@ if (function_exists("display_error_form") && !isset($config['system']['webgui'][
strcasecmp
(
$http_host
,
$config
[
'system'
][
'hostname'
])
==
0
)
strcasecmp
(
$http_host
,
$config
[
'system'
][
'hostname'
])
==
0
)
$found_host
=
true
;
$found_host
=
true
;
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
is_array
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
!
$found_host
)
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
!
$found_host
)
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$dyndns
)
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$dyndns
)
if
(
strcasecmp
(
$dyndns
[
'host'
],
$http_host
)
==
0
)
{
if
(
strcasecmp
(
$dyndns
[
'host'
],
$http_host
)
==
0
)
{
$found_host
=
true
;
$found_host
=
true
;
break
;
break
;
}
}
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
is_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
!
$found_host
)
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
!
$found_host
)
{
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$rfc2136
)
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$rfc2136
)
{
if
(
strcasecmp
(
$rfc2136
[
'host'
],
$http_host
)
==
0
)
{
if
(
strcasecmp
(
$rfc2136
[
'host'
],
$http_host
)
==
0
)
{
$found_host
=
true
;
$found_host
=
true
;
break
;
break
;
}
}
}
}
if
(
!
empty
(
$config
[
'system'
][
'webgui'
][
'althostnames'
])
&&
!
$found_host
)
{
if
(
!
empty
(
$config
[
'system'
][
'webgui'
][
'althostnames'
])
&&
!
$found_host
)
{
$althosts
=
explode
(
" "
,
$config
[
'system'
][
'webgui'
][
'althostnames'
]);
$althosts
=
explode
(
" "
,
$config
[
'system'
][
'webgui'
][
'althostnames'
]);
foreach
(
$althosts
as
$ah
)
foreach
(
$althosts
as
$ah
)
{
if
(
strcasecmp
(
$ah
,
$http_host
)
==
0
or
strcasecmp
(
$ah
,
$_SERVER
[
'SERVER_ADDR'
])
==
0
)
{
if
(
strcasecmp
(
$ah
,
$http_host
)
==
0
or
strcasecmp
(
$ah
,
$_SERVER
[
'SERVER_ADDR'
])
==
0
)
{
$found_host
=
true
;
$found_host
=
true
;
break
;
break
;
}
}
}
}
}
if
(
$found_host
==
false
)
{
if
(
$found_host
==
false
)
{
...
@@ -122,7 +125,7 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui']['
...
@@ -122,7 +125,7 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui']['
||
strcasecmp
(
$referrer_host
,
$config
[
'system'
][
'hostname'
])
==
0
)
||
strcasecmp
(
$referrer_host
,
$config
[
'system'
][
'hostname'
])
==
0
)
$found_host
=
true
;
$found_host
=
true
;
if
(
!
empty
(
$config
[
'system'
][
'webgui'
][
'althostnames'
])
&&
!
$found_host
)
{
if
(
!
empty
(
$config
[
'system'
][
'webgui'
][
'althostnames'
])
&&
!
$found_host
)
{
$althosts
=
explode
(
" "
,
$config
[
'system'
][
'webgui'
][
'althostnames'
]);
$althosts
=
explode
(
" "
,
$config
[
'system'
][
'webgui'
][
'althostnames'
]);
foreach
(
$althosts
as
$ah
)
{
foreach
(
$althosts
as
$ah
)
{
if
(
strcasecmp
(
$referrer_host
,
$ah
)
==
0
)
{
if
(
strcasecmp
(
$referrer_host
,
$ah
)
==
0
)
{
...
@@ -132,19 +135,23 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui']['
...
@@ -132,19 +135,23 @@ if(function_exists("display_error_form") && !isset($config['system']['webgui']['
}
}
}
}
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
is_array
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
!
$found_host
)
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
])
&&
!
$found_host
)
{
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$dyndns
)
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$dyndns
)
{
if
(
strcasecmp
(
$dyndns
[
'host'
],
$referrer_host
)
==
0
)
{
if
(
strcasecmp
(
$dyndns
[
'host'
],
$referrer_host
)
==
0
)
{
$found_host
=
true
;
$found_host
=
true
;
break
;
break
;
}
}
}
}
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
is_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
!
$found_host
)
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
!
$found_host
)
{
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$rfc2136
)
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$rfc2136
)
{
if
(
strcasecmp
(
$rfc2136
[
'host'
],
$referrer_host
)
==
0
)
{
if
(
strcasecmp
(
$rfc2136
[
'host'
],
$referrer_host
)
==
0
)
{
$found_host
=
true
;
$found_host
=
true
;
break
;
break
;
}
}
}
}
if
(
!
$found_host
)
{
if
(
!
$found_host
)
{
$found_host
=
isAuthLocalIP
(
$referrer_host
);
$found_host
=
isAuthLocalIP
(
$referrer_host
);
...
...
src/etc/inc/openvpn-client-export.inc
View file @
936dead8
...
@@ -904,16 +904,19 @@ function openvpn_client_export_find_port_forwards($targetip, $targetport, $targe
...
@@ -904,16 +904,19 @@ function openvpn_client_export_find_port_forwards($targetip, $targetport, $targe
return
$destinations
;
return
$destinations
;
}
}
function
openvpn_client_export_find_hostname
(
$interface
)
{
function
openvpn_client_export_find_hostname
(
$interface
)
{
global
$config
;
global
$config
;
$hostname
=
""
;
if
(
is_array
(
$config
[
'dyndnses'
][
'dyndns'
]))
{
$hostname
=
''
;
if
(
isset
(
$config
[
'dyndnses'
][
'dyndns'
]))
{
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$ddns
)
{
foreach
(
$config
[
'dyndnses'
][
'dyndns'
]
as
$ddns
)
{
if
((
$ddns
[
'interface'
]
==
$interface
)
&&
isset
(
$ddns
[
'enable'
])
&&
!
empty
(
$ddns
[
'host'
])
&&
!
is_numeric
(
$ddns
[
'host'
])
&&
is_hostname
(
$ddns
[
'host'
]))
if
((
$ddns
[
'interface'
]
==
$interface
)
&&
isset
(
$ddns
[
'enable'
])
&&
!
empty
(
$ddns
[
'host'
])
&&
!
is_numeric
(
$ddns
[
'host'
])
&&
is_hostname
(
$ddns
[
'host'
]))
return
$ddns
[
'host'
];
return
$ddns
[
'host'
];
}
}
}
}
if
(
is
_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
if
(
is
set
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$ddns
)
{
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$ddns
)
{
if
((
$ddns
[
'interface'
]
==
$interface
)
&&
isset
(
$ddns
[
'enable'
])
&&
!
empty
(
$ddns
[
'host'
])
&&
!
is_numeric
(
$ddns
[
'host'
])
&&
is_hostname
(
$ddns
[
'host'
]))
if
((
$ddns
[
'interface'
]
==
$interface
)
&&
isset
(
$ddns
[
'enable'
])
&&
!
empty
(
$ddns
[
'host'
])
&&
!
is_numeric
(
$ddns
[
'host'
])
&&
is_hostname
(
$ddns
[
'host'
]))
return
$ddns
[
'host'
];
return
$ddns
[
'host'
];
...
...
src/etc/inc/services.inc
View file @
936dead8
...
@@ -2247,8 +2247,7 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
...
@@ -2247,8 +2247,7 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
{
{
global
$config
;
global
$config
;
/* Dynamic DNS updating active? */
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
if
(
isset
(
$config
[
'dnsupdates'
][
'dnsupdate'
])
&&
is_array
(
$config
[
'dnsupdates'
][
'dnsupdate'
]))
{
$notify_text
=
""
;
$notify_text
=
""
;
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$i
=>
$dnsupdate
)
{
foreach
(
$config
[
'dnsupdates'
][
'dnsupdate'
]
as
$i
=>
$dnsupdate
)
{
if
(
!
isset
(
$dnsupdate
[
'enable'
]))
{
if
(
!
isset
(
$dnsupdate
[
'enable'
]))
{
...
@@ -2259,7 +2258,6 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
...
@@ -2259,7 +2258,6 @@ function services_dnsupdate_process($int = '', $updatehost = '', $forced = false
continue
;
continue
;
}
}
/* determine interface name */
$if
=
get_real_interface
(
$dnsupdate
[
'interface'
]);
$if
=
get_real_interface
(
$dnsupdate
[
'interface'
]);
if
(
isset
(
$dnsupdate
[
'usepublicip'
]))
{
if
(
isset
(
$dnsupdate
[
'usepublicip'
]))
{
...
...
src/www/diag_backup.php
View file @
936dead8
...
@@ -143,6 +143,7 @@ $areas = array(
...
@@ -143,6 +143,7 @@ $areas = array(
'dhcrelay6'
=>
gettext
(
'DHCPv6 Relay'
),
'dhcrelay6'
=>
gettext
(
'DHCPv6 Relay'
),
'dnsmasq'
=>
gettext
(
'DNS Forwarder'
),
'dnsmasq'
=>
gettext
(
'DNS Forwarder'
),
'dyndnses'
=>
gettext
(
'Dynamic DNS'
),
'dyndnses'
=>
gettext
(
'Dynamic DNS'
),
'dnsupdates'
=>
gettext
(
'RFC 2136'
),
'filter'
=>
gettext
(
'Firewall Rules'
),
'filter'
=>
gettext
(
'Firewall Rules'
),
'gateways'
=>
gettext
(
'Gateways'
),
'gateways'
=>
gettext
(
'Gateways'
),
'gifs'
=>
gettext
(
'GIF Devices'
),
'gifs'
=>
gettext
(
'GIF Devices'
),
...
...
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