Commit a886c95d authored by Franco Fichtner's avatar Franco Fichtner

services: verify ddns domain key as Base64; closes #1035

Geez, PHP won't really tell if decode failed so we go full circle.

(cherry picked from commit 06ababd8)
parent a89d2ce4
......@@ -284,6 +284,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if ((!empty($pconfig['ddnsdomain']) && !is_ipaddrv4($pconfig['ddnsdomainprimary']))) {
$input_errors[] = gettext("A valid primary domain name server IP address must be specified for the dynamic domain name.");
}
if (!empty($pconfig['ddnsdomainkey']) && base64_encode(base64_decode($pconfig['ddnsdomainkey'], true)) !== $pconfig['ddnsdomainkey']) {
$input_errors[] = gettext('You must specify a Base64-encoded domain key.');
}
if ((!empty($pconfig['ddnsdomainkey']) && empty($pconfig['ddnsdomainkeyname'])) ||
(!empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey']))
) {
......
......@@ -176,6 +176,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (!empty($pconfig['ddnsdomain']) && !is_ipaddrv4($pconfig['ddnsdomainprimary'])) {
$input_errors[] = gettext("A valid primary domain name server IPv4 address must be specified for the dynamic domain name.");
}
if (!empty($pconfig['ddnsdomainkey']) && base64_encode(base64_decode($pconfig['ddnsdomainkey'], true)) !== $pconfig['ddnsdomainkey']) {
$input_errors[] = gettext('You must specify a Base64-encoded domain key.');
}
if ((!empty($pconfig['ddnsdomainkey']) && empty($pconfig['ddnsdomainkeyname'])) ||
(!empty($pconfig['ddnsdomainkeyname']) && empty($pconfig['ddnsdomainkey']))) {
$input_errors[] = gettext("You must specify both a valid domain key and key name.");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment