Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions net/upnp/src/www/services_upnp.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,22 +154,22 @@ function miniupnpd_validate_port($port)
/* user permissions validation */
foreach (miniupnpd_permuser_list() as $i => $permuser) {
if (!empty($pconfig[$permuser])) {
$perm = explode(' ', $pconfig[$permuser]);
$perm = explode(' ', trim($pconfig[$permuser]));
/* should explode to 4 args */
if (count($perm) != 4) {
$input_errors[] = sprintf(gettext("You must follow the specified format in the 'User specified permissions %s' field"), $i);
$input_errors[] = sprintf(gettext("You must follow the specified format in the 'ACL entry %s' field"), $i);
} else {
/* must with allow or deny */
if (!($perm[0] == 'allow' || $perm[0] == 'deny')) {
$input_errors[] = sprintf(gettext("You must begin with allow or deny in the 'User specified permissions %s' field"), $i);
$input_errors[] = sprintf(gettext("You must begin with allow or deny in the 'ACL entry %s' field"), $i);
}
/* verify port or port range */
if (!miniupnpd_validate_port($perm[1]) || !miniupnpd_validate_port($perm[3])) {
$input_errors[] = sprintf(gettext("You must specify a port or port range between 0 and 65535 in the 'User specified permissions %s' field"), $i);
$input_errors[] = sprintf(gettext("You must specify a port or port range between 0 and 65535 in the 'ACL entry %s' field"), $i);
}
/* verify ip address */
if (!miniupnpd_validate_ip($perm[2])) {
$input_errors[] = sprintf(gettext("You must specify a valid ip address in the 'User specified permissions %s' field"), $i);
$input_errors[] = sprintf(gettext("You must specify a valid ip address in the 'ACL entry %s' field"), $i);
}
}
}
Expand All @@ -191,7 +191,7 @@ function miniupnpd_validate_port($port)
$upnp[$fieldname] = $pconfig[$fieldname];
}
foreach (miniupnpd_permuser_list() as $fieldname) {
$upnp[$fieldname] = $pconfig[$fieldname];
$upnp[$fieldname] = trim($pconfig[$fieldname] ?? '');
}
// array types
$upnp['iface_array'] = implode(',', $pconfig['iface_array']);
Expand Down