summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/pkg_edit.php
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2015-11-17 11:22:51 +0100
committerdoktornotor <notordoktor@gmail.com>2015-11-17 11:22:51 +0100
commit6e5cec8e6b125b89e4a964c274233b1509a07c72 (patch)
treebd84cb36a90a0c45d1d81c309b4ccd218a17a5c2 /src/usr/local/www/pkg_edit.php
parentb1fd554296494b5d771e263c664ee92c23fbb0fe (diff)
downloadpfsense-6e5cec8e6b125b89e4a964c274233b1509a07c72.zip
pfsense-6e5cec8e6b125b89e4a964c274233b1509a07c72.tar.gz
pkg_edit.php - base64 encoding/decoding fixes (Bug #5134)
Currently, the base64 is only usable for textarea fields - see Bug #5134 for details. This adds base64_decode() to input and password field types if &lt;encoding&gt;base64&lt;/encoding&gt; tag is set for those fields (also for rowhelpers) to prevent the values from getting perpetually re-encoded which makes it unusable for those field types. Ideally, usage of the &lt;encoding&gt; tag should be prevented for fields type where it doesn't make any sense whatsoever, someone else needs to look into that, the packages.dtd XSD schema is a pathetic useless POS.
Diffstat (limited to 'src/usr/local/www/pkg_edit.php')
-rw-r--r--src/usr/local/www/pkg_edit.php17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php
index 0e9a2dc..71c18e3 100644
--- a/src/usr/local/www/pkg_edit.php
+++ b/src/usr/local/www/pkg_edit.php
@@ -690,7 +690,11 @@ foreach ($pkg['fields']['field'] as $pkga) {
// Create an input element. The format is slightly different depending on whether we are composing a group,
// section, or advanced section. This is true for every element type
case "input":
- if($grouping) {
+ if (($pkga['encoding'] == 'base64') && !$get_from_post && !empty($value)) {
+ $value = base64_decode($value);
+ }
+
+ if ($grouping) {
$group->add(new Form_Input(
$pkga['fieldname'],
$pkga['fielddescr'],
@@ -718,8 +722,12 @@ foreach ($pkg['fields']['field'] as $pkga) {
break;
case "password":
+ if (($pkga['encoding'] == 'base64') && !$get_from_post && !empty($value)) {
+ $value = base64_decode($value);
+ }
+
// Create a password element
- if($grouping) {
+ if ($grouping) {
$group->add(new Form_Input(
$pkga['fieldname'],
$pkga['fielddescr'],
@@ -1325,6 +1333,11 @@ foreach ($pkg['fields']['field'] as $pkga) {
}
$type = $rowhelper['type'];
+ if ($type == "input" || $type == "password" || $type == "textarea" ) {
+ if (($rowhelper['encoding'] == 'base64') && !$get_from_post && !empty($value)) {
+ $value = base64_decode($value);
+ }
+ }
$fieldname = $rowhelper['fieldname'];
if ($rowhelper['size']) {
OpenPOWER on IntegriCloud