diff --git a/ChangeLog b/ChangeLog
index dadcb3e02..d8efca466 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@ $HeadURL: https://phpmyadmin.svn.sourceforge.net/svnroot/phpmyadmin/trunk/phpMyA
Kinkhorst)
- [core] do not automatically set and create TempDir, it might lead to security
issue (thanks to Thijs Kinkhorst)
+- [setup] avoid usage of (un)serialize, what might be unsafe in some cases
2.11.9.6 (2009-10-12)
- [security] XSS and SQL injection, thanks to Herman van Rink
diff --git a/scripts/setup.php b/scripts/setup.php
index 16a9a2aaa..2f3d09d45 100644
--- a/scripts/setup.php
+++ b/scripts/setup.php
@@ -37,35 +37,32 @@ if (isset($_POST['action'])) {
// Grab wanted CRLF type
if (isset($_POST['eoltype'])) {
- $eoltype = $_POST['eoltype'];
+ $_SESSION['eoltype'] = $_POST['eoltype'];
} else {
if (PMA_USR_OS == 'Win') {
- $eoltype = 'dos';
+ $_SESSION['eoltype'] = 'dos';
} else {
- $eoltype = 'unix';
+ $_SESSION['eoltype'] = 'unix';
}
}
// Detect which CRLF to use
-if ($eoltype == 'dos') {
+if ($_SESSION['eoltype'] == 'dos') {
$crlf = "\r\n";
-} elseif ($eoltype == 'mac') {
+} elseif ($_SESSION['eoltype'] == 'mac') {
$crlf = "\r";
} else {
$crlf = "\n";
}
-if (isset($_POST['configuration']) && $action != 'clear') {
- // Grab previous configuration, if it should not be cleared
- $configuration = unserialize($_POST['configuration']);
-} else {
- // Start with empty configuration
- $configuration = array();
+if (!isset($_SESSION['configuration']) || $action == 'clear') {
+ // Create empty configuration
+ $_SESSION['configuration'] = array();
}
// We rely on Servers array to exist, so create it here
-if (!isset($configuration['Servers']) || !is_array($configuration['Servers'])) {
- $configuration['Servers'] = array();
+if (!isset($_SESSION['configuration']['Servers']) || !is_array($_SESSION['configuration']['Servers'])) {
+ $_SESSION['configuration']['Servers'] = array();
}
// Used later
@@ -340,20 +337,6 @@ function message($type, $text, $title = '') {
echo '' . "\n";
}
-/**
- * Creates hidden input required for keeping current configuraion
- *
- * @return string HTML with hidden inputs
- */
-function get_hidden_cfg() {
- global $configuration, $eoltype;
-
- $ret = '' . "\n";
- $ret .= '' . "\n";
-
- return $ret;
-}
-
/**
* Returns needed hidden input for forms.
*
@@ -383,7 +366,6 @@ function get_action($name, $title, $added = '', $enabled = TRUE) {
$ret .= ' disabled="disabled"';
}
$ret .= ' />';
- $ret .= get_hidden_cfg();
$ret .= '';
$ret .= "\n";
return $ret;
@@ -613,7 +595,7 @@ function compress_servers(&$cfg) {
* @param string list of values to grab, values are separated by ";",
* each can have defined type separated by ":", if no type
* is defined, string is assumed. Possible types: bool -
- * boolean value, serialized - serialized value, int -
+ * boolean value, allow-deny - allow-deny rules, int -
* integer, tristate - "TRUE"/"FALSE" converted to bool,
* other strings are kept.
*
@@ -632,9 +614,17 @@ function grab_values($list)
case 'bool':
$res[$v[0]] = isset($_POST[$v[0]]);
break;
- case 'serialized':
- if (isset($_POST[$v[0]]) && strlen($_POST[$v[0]]) > 0) {
- $res[$v[0]] = unserialize($_POST[$v[0]]);
+ case 'allow-deny':
+ $res[$v[0]] = array();
+ if (isset($_POST[$v[0] . '_order']) && strlen($_POST[$v[0] . '_order']) > 0) {
+ $res[$v[0]]['order'] = $_POST[$v[0]];
+ } else {
+ $res[$v[0]]['order'] = '';
+ }
+ if (isset($_POST[$v[0] . '_rules']) && strlen($_POST[$v[0] . '_rules']) > 0) {
+ $res[$v[0]]['rules'] = split('|', $_POST[$v[0]]);
+ } else {
+ $res[$v[0]]['rules'] = array();
}
break;
case 'int':
@@ -819,7 +809,6 @@ function show_security_form($defaults = array()) {
get('AvailableCharsets')),
@@ -905,7 +892,6 @@ function show_extensions_form($defaults = array()) {
';
}
- $hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'designer_coords', 'history', 'AllowDeny');
+ $hi = array ('bookmarktable', 'relation', 'table_info', 'table_coords', 'pdf_pages', 'column_info', 'designer_coords', 'history');
foreach ($hi as $k) {
- if (isset($defaults[$k]) && (!is_string($defaults[$k]) || strlen($defaults[$k]) > 0)) {
- echo '';
+ if (isset($defaults[$k]) && is_string($defaults[$k]) && strlen($defaults[$k]) > 0) {
+ echo '';
+ }
+ }
+ if (isset($defaults['AllowDeny'])) {
+ if (isset($defaults['AllowDeny']['order']) && is_string($defaults['AllowDeny']['order']) && strlen($defaults['AllowDeny']['order']) > 0) {
+ echo '';
+ }
+ if (isset($defaults['AllowDeny']['rules']) && is_array($defaults['AllowDeny']['rules']) && count($defaults['AllowDeny']['rules']) > 0) {
+ echo '';
}
}
show_config_form(array(
@@ -1035,7 +1026,6 @@ function show_left_form($defaults = array()) {
' . "\n";
?>