Skip to content

Commit e5c68a1

Browse files
author
Marius Cramer
committed
- fixed csrf handling on server config edit
1 parent 5364888 commit e5c68a1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

interface/lib/classes/tform.inc.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,6 @@ function encode($record, $tab, $dbencode = true) {
691691
unset($_POST);
692692
unset($record);
693693
}
694-
$_SESSION['_csrf'][$_csrf_id] = null;
695-
$_SESSION['_csrf_timeout'][$_csrf_id] = null;
696-
unset($_SESSION['_csrf'][$_csrf_id]);
697-
unset($_SESSION['_csrf_timeout'][$_csrf_id]);
698694

699695
if(isset($_SESSION['_csrf_timeout']) && is_array($_SESSION['_csrf_timeout'])) {
700696
$to_unset = array();

interface/web/admin/server_config_edit.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,15 @@ function onUpdateSave($sql) {
9292
}
9393
}
9494
}
95-
96-
$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
97-
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
98-
99-
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
95+
96+
if($app->tform->errorMessage == '') {
97+
$server_config_array[$section] = $app->tform->encode($this->dataRecord, $section);
98+
$server_config_str = $app->ini_parser->get_ini_string($server_config_array);
99+
100+
$app->db->datalogUpdate('server', "config = '".$app->db->quote($server_config_str)."'", 'server_id', $server_id);
101+
} else {
102+
$app->error('Security breach!');
103+
}
100104
}
101105
}
102106

0 commit comments

Comments
 (0)