diff options
author | Ermal LUÇI <eri@pfsense.org> | 2015-01-12 09:27:09 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2015-01-12 09:27:09 +0100 |
commit | 64ed3e60f518949adc1cc54b4ea77c618afc130c (patch) | |
tree | b25ef3c270425e0d432944f3a374f89409e755fb /etc | |
parent | ab54ec9f8d362162ada3055e99143be6ea83b5ce (diff) | |
download | pfsense-64ed3e60f518949adc1cc54b4ea77c618afc130c.zip pfsense-64ed3e60f518949adc1cc54b4ea77c618afc130c.tar.gz |
Fix inherent issues with isset and empty values set as true by our parser. This made the piep configuration to be wrong at least for passthrough entries. Ticket #3932
Diffstat (limited to 'etc')
-rw-r--r-- | etc/inc/captiveportal.inc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index a44a993..710788b 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -962,12 +962,12 @@ function captiveportal_passthrumac_configure_entry($macent, $pipeinrule = false) $bwUp = 0; if (!empty($macent['bw_up'])) $bwUp = $macent['bw_up']; - else if (isset($config['captiveportal'][$cpzone]['bwdefaultup'])) + else if (!empty($config['captiveportal'][$cpzone]['bwdefaultup'])) $bwUp = $config['captiveportal'][$cpzone]['bwdefaultup']; $bwDown = 0; if (!empty($macent['bw_down'])) $bwDown = $macent['bw_down']; - else if (isset($config['captiveportal'][$cpzone]['bwdefaultdn'])) + else if (!empty($config['captiveportal'][$cpzone]['bwdefaultdn'])) $bwDown = $config['captiveportal'][$cpzone]['bwdefaultdn']; $ruleno = captiveportal_get_next_ipfw_ruleno(); @@ -1076,12 +1076,12 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) { $enBwup = 0; if (!empty($ipent['bw_up'])) $enBwup = intval($ipent['bw_up']); - else if (isset($config['captiveportal'][$cpzone]['bwdefaultup'])) + else if (!empty($config['captiveportal'][$cpzone]['bwdefaultup'])) $enBwup = $config['captiveportal'][$cpzone]['bwdefaultup']; $enBwdown = 0; if (!empty($ipent['bw_down'])) $enBwdown = intval($ipent['bw_down']); - else if (isset($config['captiveportal'][$cpzone]['bwdefaultdn'])) + else if (!empty($config['captiveportal'][$cpzone]['bwdefaultdn'])) $enBwdown = $config['captiveportal'][$cpzone]['bwdefaultdn']; $pipeno = captiveportal_get_next_dn_ruleno(); @@ -1801,12 +1801,12 @@ function captiveportal_reapply_attributes($cpentry, $attributes) { global $config, $cpzone, $g; if (isset($config['captiveportal'][$cpzone]['peruserbw'])) { - $dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0; - $dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0; + $dwfaultbw_up = !empty($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0; + $dwfaultbw_down = !empty($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0; } else $dwfaultbw_up = $dwfaultbw_down = 0; - $bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; - $bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; + $bw_up = !empty($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; + $bw_down = !empty($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; $bw_up_pipeno = $cpentry[1]; $bw_down_pipeno = $cpentry[1]+1; @@ -1982,12 +1982,12 @@ function portal_allow($clientip,$clientmac,$username,$password = null, $attribut } if (isset($config['captiveportal'][$cpzone]['peruserbw'])) { - $dwfaultbw_up = isset($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0; - $dwfaultbw_down = isset($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0; + $dwfaultbw_up = !empty($config['captiveportal'][$cpzone]['bwdefaultup']) ? $config['captiveportal'][$cpzone]['bwdefaultup'] : 0; + $dwfaultbw_down = !empty($config['captiveportal'][$cpzone]['bwdefaultdn']) ? $config['captiveportal'][$cpzone]['bwdefaultdn'] : 0; } else $dwfaultbw_up = $dwfaultbw_down = 0; - $bw_up = isset($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; - $bw_down = isset($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; + $bw_up = !empty($attributes['bw_up']) ? round(intval($attributes['bw_up'])/1000, 2) : $dwfaultbw_up; + $bw_down = !empty($attributes['bw_down']) ? round(intval($attributes['bw_down'])/1000, 2) : $dwfaultbw_down; $bw_up_pipeno = $pipeno; $bw_down_pipeno = $pipeno + 1; |