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
45602999
Commit
45602999
authored
Mar 04, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services/dyndns: general sanity and custom* hostname apply fix
parent
9e078f91
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
33 deletions
+63
-33
services.inc
src/etc/inc/services.inc
+34
-3
services_dyndns.php
src/www/services_dyndns.php
+8
-9
services_dyndns_edit.php
src/www/services_dyndns_edit.php
+12
-10
dyn_dns_status.widget.php
src/www/widgets/widgets/dyn_dns_status.widget.php
+9
-11
No files found.
src/etc/inc/services.inc
View file @
45602999
...
@@ -27,9 +27,6 @@
...
@@ -27,9 +27,6 @@
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
define
(
'DYNDNS_PROVIDER_VALUES'
,
'dnsomatic dyndns dyndns-static dyndns-custom dhs dyns easydns noip noip-free ods zoneedit loopia freedns dnsexit opendns namecheap he-net he-net-v6 he-net-tunnelbroker selfhost route53 cloudflare custom custom-v6 eurodns gratisdns ovh-dynhost citynetwork'
);
define
(
'DYNDNS_PROVIDER_DESCRIPTIONS'
,
'DNS-O-Matic,DynDNS (dynamic),DynDNS (static),DynDNS (custom),DHS,DyNS,easyDNS,No-IP,No-IP (free),ODS.org,ZoneEdit,Loopia,freeDNS,DNSexit,OpenDNS,Namecheap,HE.net,HE.net (v6),HE.net Tunnelbroker,SelfHost,Route 53,CloudFlare,Custom,Custom (v6),Euro Dns,GratisDNS,OVH DynHOST,City Network'
);
/* implement ipv6 route advertising deamon */
/* implement ipv6 route advertising deamon */
function
services_radvd_configure
(
$blacklist
=
array
())
function
services_radvd_configure
(
$blacklist
=
array
())
{
{
...
@@ -1595,6 +1592,40 @@ function services_dhcrelay6_configure()
...
@@ -1595,6 +1592,40 @@ function services_dhcrelay6_configure()
return
0
;
return
0
;
}
}
function
services_dyndns_list
()
{
return
array
(
'dnsomatic'
=>
'DNS-O-Matic'
,
'dyndns'
=>
'DynDNS (dynamic)'
,
'dyndns-static'
=>
'DynDNS (static)'
,
'dyndns-custom'
=>
'DynDNS (custom)'
,
'dhs'
=>
'DHS'
,
'dyns'
=>
'DyNS'
,
'easydns'
=>
'easyDNS'
,
'noip'
=>
'No-IP'
,
'noip-free'
=>
'No-IP (free)'
,
'ods'
=>
'ODS.org'
,
'zoneedit'
=>
'ZoneEdit'
,
'loopia'
=>
'Loopia'
,
'freedns'
=>
'freeDNS'
,
'dnsexit'
=>
'DNSexit'
,
'opendns'
=>
'OpenDNS'
,
'namecheap'
=>
'Namecheap'
,
'he-net'
=>
'HE.net'
,
'he-net-v6'
=>
'HE.net (v6)'
,
'he-net-tunnelbroker'
=>
'HE.net Tunnelbroker'
,
'selfhost'
=>
'SelfHost'
,
'route53'
=>
'Route 53'
,
'cloudflare'
=>
'CloudFlare'
,
'custom'
=>
'Custom'
,
'custom-v6'
=>
'Custom (v6)'
,
'eurodns'
=>
'EuroDNS'
,
'gratisdns'
=>
'GratisDNS'
,
'ovh-dynhost'
=>
'OVH DynHOST'
,
'citynetwork'
=>
'City Network'
);
}
function
services_dyndns_configure_client
(
$conf
)
{
function
services_dyndns_configure_client
(
$conf
)
{
if
(
!
isset
(
$conf
[
'enable'
]))
if
(
!
isset
(
$conf
[
'enable'
]))
...
...
src/www/services_dyndns.php
View file @
45602999
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2008 Ermal Luçi
Copyright (C) 2008 Ermal Luçi
...
@@ -119,16 +120,14 @@ $main_buttons = array(
...
@@ -119,16 +120,14 @@ $main_buttons = array(
</td>
</td>
<td
class=
"listr"
>
<td
class=
"listr"
>
<?php
<?php
$types
=
explode
(
","
,
DYNDNS_PROVIDER_DESCRIPTIONS
);
$types
=
services_dyndns_list
();
$vals
=
explode
(
" "
,
DYNDNS_PROVIDER_VALUES
);
if
(
isset
(
$types
[
$dyndns
[
'type'
]]))
{
for
(
$j
=
0
;
$j
<
count
(
$vals
);
$j
++
)
if
(
!
isset
(
$dyndns
[
'enable'
]))
{
if
(
$vals
[
$j
]
==
$dyndns
[
'type'
])
{
echo
'<span class="gray">'
.
htmlspecialchars
(
$types
[
$dyndns
[
'type'
]])
.
'</span>'
;
if
(
!
isset
(
$dyndns
[
'enable'
]))
}
else
{
echo
"<span class=
\"
gray
\"
>"
.
htmlspecialchars
(
$types
[
$j
])
.
"</span>"
;
echo
htmlspecialchars
(
$types
[
$dyndns
[
'type'
]]);
else
echo
htmlspecialchars
(
$types
[
$j
]);
break
;
}
}
}
?>
?>
</td>
</td>
<td
class=
"listr"
>
<td
class=
"listr"
>
...
...
src/www/services_dyndns_edit.php
View file @
45602999
<?php
<?php
/*
/*
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2014-2015 Deciso B.V.
Copyright (C) 2008 Ermal Luçi
Copyright (C) 2008 Ermal Luçi
...
@@ -83,7 +84,7 @@ if ($_POST) {
...
@@ -83,7 +84,7 @@ if ($_POST) {
$reqdfieldsn
=
array
();
$reqdfieldsn
=
array
();
$reqdfields
=
array
(
"type"
);
$reqdfields
=
array
(
"type"
);
$reqdfieldsn
=
array
(
gettext
(
"Service type"
));
$reqdfieldsn
=
array
(
gettext
(
"Service type"
));
if
(
$pconfig
[
'type'
]
!=
"custom"
&&
$pconfig
[
'type'
]
!=
"custom-v6"
)
{
if
(
$pconfig
[
'type'
]
!=
'custom'
&&
$pconfig
[
'type'
]
!=
'custom-v6'
)
{
$reqdfields
[]
=
"host"
;
$reqdfields
[]
=
"host"
;
$reqdfieldsn
[]
=
gettext
(
"Hostname"
);
$reqdfieldsn
[]
=
gettext
(
"Hostname"
);
$reqdfields
[]
=
"password"
;
$reqdfields
[]
=
"password"
;
...
@@ -97,7 +98,7 @@ if ($_POST) {
...
@@ -97,7 +98,7 @@ if ($_POST) {
do_input_validation
(
$_POST
,
$reqdfields
,
$reqdfieldsn
,
$input_errors
);
do_input_validation
(
$_POST
,
$reqdfields
,
$reqdfieldsn
,
$input_errors
);
if
(
isset
(
$_POST
[
'host'
]))
{
if
(
isset
(
$_POST
[
'host'
])
&&
in_array
(
'host'
,
$reqdfields
)
)
{
/* Namecheap can have a @. in hostname */
/* Namecheap can have a @. in hostname */
if
(
$pconfig
[
'type'
]
==
"namecheap"
&&
substr
(
$_POST
[
'host'
],
0
,
2
)
==
'@.'
)
if
(
$pconfig
[
'type'
]
==
"namecheap"
&&
substr
(
$_POST
[
'host'
],
0
,
2
)
==
'@.'
)
$host_to_check
=
substr
(
$_POST
[
'host'
],
2
);
$host_to_check
=
substr
(
$_POST
[
'host'
],
2
);
...
@@ -109,6 +110,7 @@ if ($_POST) {
...
@@ -109,6 +110,7 @@ if ($_POST) {
unset
(
$host_to_check
);
unset
(
$host_to_check
);
}
}
if
((
$_POST
[
'mx'
]
&&
!
is_domain
(
$_POST
[
'mx'
])))
if
((
$_POST
[
'mx'
]
&&
!
is_domain
(
$_POST
[
'mx'
])))
$input_errors
[]
=
gettext
(
"The MX contains invalid characters."
);
$input_errors
[]
=
gettext
(
"The MX contains invalid characters."
);
if
((
in_array
(
"username"
,
$reqdfields
)
&&
$_POST
[
'username'
]
&&
!
is_dyndns_username
(
$_POST
[
'username'
]))
||
((
in_array
(
"username"
,
$reqdfields
))
&&
(
$_POST
[
'username'
]
==
""
)))
if
((
in_array
(
"username"
,
$reqdfields
)
&&
$_POST
[
'username'
]
&&
!
is_dyndns_username
(
$_POST
[
'username'
]))
||
((
in_array
(
"username"
,
$reqdfields
))
&&
(
$_POST
[
'username'
]
==
""
)))
...
@@ -250,14 +252,14 @@ include("head.inc");
...
@@ -250,14 +252,14 @@ include("head.inc");
<td
width=
"22%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Service type"
);
?>
</td>
<td
width=
"22%"
valign=
"top"
class=
"vncellreq"
>
<?=
gettext
(
"Service type"
);
?>
</td>
<td
width=
"78%"
class=
"vtable"
>
<td
width=
"78%"
class=
"vtable"
>
<select
name=
"type"
class=
"formselect"
id=
"type"
onchange=
"_onTypeChange(this.options[this.selectedIndex].value);"
>
<select
name=
"type"
class=
"formselect"
id=
"type"
onchange=
"_onTypeChange(this.options[this.selectedIndex].value);"
>
<?php
<?php
$types
=
explode
(
","
,
DYNDNS_PROVIDER_DESCRIPTIONS
);
$types
=
services_dyndns_list
(
);
$vals
=
explode
(
" "
,
DYNDNS_PROVIDER_VALUES
);
foreach
(
$types
as
$value
=>
$type
)
{
$j
=
0
;
for
(
$j
=
0
;
$j
<
count
(
$vals
);
$j
++
)
:
?>
?>
<option
value=
"
<?=
$val
s
[
$j
];
?>
"
<?php
if
(
$vals
[
$j
]
==
$pconfig
[
'type'
])
echo
"selected=
\"
selected
\"
"
;
?>
>
<option
value=
"
<?=
$val
ue
;
?>
"
<?php
if
(
$value
==
$pconfig
[
'type'
])
echo
'selected="selected"'
;
?>
>
<?=
htmlspecialchars
(
$type
);
?>
</option
>
<?=
htmlspecialchars
(
$types
[
$j
]);
?>
<?php
</option>
}
<?php
endfor
;
?>
?>
</select></td>
</select></td>
</tr>
</tr>
<tr>
<tr>
...
...
src/www/widgets/widgets/dyn_dns_status.widget.php
View file @
45602999
<?php
<?php
/*
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2008 Ermal Luci
Copyright (C) 2008 Ermal Luci
Copyright (C) 2013 Stanley P. Miller \ stan-qaz
Copyright (C) 2013 Stanley P. Miller \ stan-qaz
All rights reserved.
All rights reserved.
...
@@ -27,7 +28,6 @@
...
@@ -27,7 +28,6 @@
POSSIBILITY OF SUCH DAMAGE.
POSSIBILITY OF SUCH DAMAGE.
*/
*/
$nocsrf
=
true
;
$nocsrf
=
true
;
require_once
(
"guiconfig.inc"
);
require_once
(
"guiconfig.inc"
);
...
@@ -103,16 +103,14 @@ if($_REQUEST['getdyndnsstatus']) {
...
@@ -103,16 +103,14 @@ if($_REQUEST['getdyndnsstatus']) {
</td>
</td>
<td
class=
"listr"
>
<td
class=
"listr"
>
<?php
<?php
$types
=
explode
(
","
,
DYNDNS_PROVIDER_DESCRIPTIONS
);
$types
=
services_dyndns_list
();
$vals
=
explode
(
" "
,
DYNDNS_PROVIDER_VALUES
);
if
(
isset
(
$types
[
$dyndns
[
'type'
]]))
{
for
(
$j
=
0
;
$j
<
count
(
$vals
);
$j
++
)
if
(
!
isset
(
$dyndns
[
'enable'
]))
{
if
(
$vals
[
$j
]
==
$dyndns
[
'type'
])
{
echo
'<span class="gray">'
.
htmlspecialchars
(
$types
[
$dyndns
[
'type'
]])
.
'</span>'
;
if
(
!
isset
(
$dyndns
[
'enable'
]))
}
else
{
echo
"<span class=
\"
gray
\"
>"
.
htmlspecialchars
(
$types
[
$j
])
.
"</span>"
;
echo
htmlspecialchars
(
$types
[
$dyndns
[
'type'
]]);
else
echo
htmlspecialchars
(
$types
[
$j
]);
break
;
}
}
}
?>
?>
</td>
</td>
<td
class=
"listr"
>
<td
class=
"listr"
>
...
...
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