diff --git a/bureau/admin/adm_add.php b/bureau/admin/adm_add.php old mode 100644 new mode 100755 index dd7681c3..7c874e22 --- a/bureau/admin/adm_add.php +++ b/bureau/admin/adm_add.php @@ -60,7 +60,7 @@ if (isset($error) && $error) { } ?>
diff --git a/bureau/admin/adm_deactivate.php b/bureau/admin/adm_deactivate.php old mode 100644 new mode 100755 index 442410b0..da1d9218 --- a/bureau/admin/adm_deactivate.php +++ b/bureau/admin/adm_deactivate.php @@ -69,6 +69,7 @@ if (! ($confirmed ) ) { ?>
@@ -69,6 +70,7 @@ if (isset($error) && $error) {
/> @@ -149,6 +150,7 @@ if (!is_array($accountList) || empty($accountList)) { ?> + - + diff --git a/bureau/admin/adm_passpolicy.php b/bureau/admin/adm_passpolicy.php old mode 100644 new mode 100755 index 260e05d8..8b679e0b --- a/bureau/admin/adm_passpolicy.php +++ b/bureau/admin/adm_passpolicy.php @@ -84,6 +84,7 @@ if (!empty($edit)) { + diff --git a/bureau/admin/adm_quotaedit.php b/bureau/admin/adm_quotaedit.php old mode 100644 new mode 100755 index e274e672..57413e61 --- a/bureau/admin/adm_quotaedit.php +++ b/bureau/admin/adm_quotaedit.php @@ -63,6 +63,7 @@ $mem->unsu(); } ?> + diff --git a/bureau/admin/adm_slavedns.php b/bureau/admin/adm_slavedns.php old mode 100644 new mode 100755 index a1cd004d..253ba2b3 --- a/bureau/admin/adm_slavedns.php +++ b/bureau/admin/adm_slavedns.php @@ -110,6 +110,7 @@ if (is_array($c)) { ?> + @@ -154,7 +155,7 @@ if (is_array($c)) { ?> - + diff --git a/bureau/admin/adm_tld.php b/bureau/admin/adm_tld.php old mode 100644 new mode 100755 index d47b0e94..d55e51e3 --- a/bureau/admin/adm_tld.php +++ b/bureau/admin/adm_tld.php @@ -69,6 +69,7 @@ $c=$admin->listtld(); + - + diff --git a/bureau/admin/adm_tldedit.php b/bureau/admin/adm_tldedit.php old mode 100644 new mode 100755 index 090dce53..b52cf168 --- a/bureau/admin/adm_tldedit.php +++ b/bureau/admin/adm_tldedit.php @@ -60,6 +60,7 @@ include_once("head.php"); + diff --git a/bureau/admin/adm_variables.php b/bureau/admin/adm_variables.php old mode 100644 new mode 100755 index 9e40812a..047b2162 --- a/bureau/admin/adm_variables.php +++ b/bureau/admin/adm_variables.php @@ -53,6 +53,7 @@ include_once ("head.php"); + content($R,$editfile); ?> + diff --git a/bureau/admin/bro_main.php b/bureau/admin/bro_main.php old mode 100644 new mode 100755 index cf03f6f4..3156ba27 --- a/bureau/admin/bro_main.php +++ b/bureau/admin/bro_main.php @@ -96,6 +96,7 @@ if (!empty($formu) && $formu) { ?> : + @@ -184,6 +185,7 @@ if (isset($error) && $error) echo "$error"; + @@ -200,6 +202,7 @@ if (isset($error) && $error) echo "$error"; + @@ -221,6 +224,7 @@ if (isset($error) && $error) echo "$error"; if (isset($formu) && $formu==2 && isset($actrename) && $actrename && count($d)) { echo "\n"; echo "\n"; + csrf_get(); echo "\n"; echo "\n"; echo ""._("Rename").""; @@ -237,6 +241,7 @@ if (isset($formu) && $formu==2 && isset($actrename) && $actrename && count($d)) /* [ML] Changer les permissions : */ if ($formu==2 && ! (empty($actperms)) && count($d)) { echo "\n"; + csrf_get(); echo "\n"; echo "\n"; echo ""._("Permissions").""; @@ -277,6 +282,7 @@ if (count($c)) { ?> + diff --git a/bureau/admin/bro_pref.php b/bureau/admin/bro_pref.php old mode 100644 new mode 100755 index 0c284079..d50e9b7a --- a/bureau/admin/bro_pref.php +++ b/bureau/admin/bro_pref.php @@ -60,7 +60,7 @@ include_once("head.php"); - + diff --git a/bureau/admin/browseforfolder2.php b/bureau/admin/browseforfolder2.php old mode 100644 new mode 100755 index 6a23af65..3beb5cce --- a/bureau/admin/browseforfolder2.php +++ b/bureau/admin/browseforfolder2.php @@ -139,6 +139,7 @@ if ($errbrowsefold) { reset($ar); ?> + diff --git a/bureau/admin/cron.php b/bureau/admin/cron.php old mode 100644 new mode 100755 index 1ae06b56..10f5b7fc --- a/bureau/admin/cron.php +++ b/bureau/admin/cron.php @@ -27,7 +27,7 @@ $lst_cron = $cron->lst_cron(); - + diff --git a/bureau/admin/ftp_list.php b/bureau/admin/ftp_list.php old mode 100644 new mode 100755 index 87ba07d9..17214dd5 --- a/bureau/admin/ftp_list.php +++ b/bureau/admin/ftp_list.php @@ -68,6 +68,7 @@ if (isset($error) && $error && !$noftp) { ?> + diff --git a/bureau/admin/hta_add.php b/bureau/admin/hta_add.php old mode 100644 new mode 100755 index 331a01f7..7266899f --- a/bureau/admin/hta_add.php +++ b/bureau/admin/hta_add.php @@ -50,6 +50,7 @@ if (isset($error) && $error) { } ?> + diff --git a/bureau/admin/hta_adduser.php b/bureau/admin/hta_adduser.php old mode 100644 new mode 100755 index 8b421644..8b2b3e25 --- a/bureau/admin/hta_adduser.php +++ b/bureau/admin/hta_adduser.php @@ -45,7 +45,7 @@ getFields($fields); ?> - + diff --git a/bureau/admin/hta_dodeluser.php b/bureau/admin/hta_dodeluser.php old mode 100644 new mode 100755 index a5270def..62bb4798 --- a/bureau/admin/hta_dodeluser.php +++ b/bureau/admin/hta_dodeluser.php @@ -57,6 +57,7 @@ include_once('head.php'); + \n"; diff --git a/bureau/admin/hta_edit.php b/bureau/admin/hta_edit.php old mode 100644 new mode 100755 index eacd2ace..4ea1ec1c --- a/bureau/admin/hta_edit.php +++ b/bureau/admin/hta_edit.php @@ -57,6 +57,7 @@ if (!$dir) { reset($r); ?> + @@ -91,7 +92,7 @@ for($i=0;$i - + diff --git a/bureau/admin/hta_edituser.php b/bureau/admin/hta_edituser.php old mode 100644 new mode 100755 index ce4c6493..2faddef9 --- a/bureau/admin/hta_edituser.php +++ b/bureau/admin/hta_edituser.php @@ -44,6 +44,7 @@ getFields($fields); $error"; } ?> + diff --git a/bureau/admin/hta_list.php b/bureau/admin/hta_list.php old mode 100644 new mode 100755 index 5648e802..f2a93cfc --- a/bureau/admin/hta_list.php +++ b/bureau/admin/hta_list.php @@ -64,6 +64,7 @@ $mem->show_help("hta_list2"); + ";__("You are attemping to connect without IP restriction."); echo ""; } ?> + diff --git a/bureau/admin/ip_main.php b/bureau/admin/ip_main.php old mode 100644 new mode 100755 index 7f5794c6..57c4d34c --- a/bureau/admin/ip_main.php +++ b/bureau/admin/ip_main.php @@ -89,6 +89,7 @@ $lac = $authip->list_affected(); + @@ -176,6 +177,7 @@ foreach($list_ip as $i) { );" > + diff --git a/bureau/admin/mail_del.php b/bureau/admin/mail_del.php old mode 100644 new mode 100755 index d67caffe..2cfa10ae --- a/bureau/admin/mail_del.php +++ b/bureau/admin/mail_del.php @@ -56,6 +56,7 @@ if ($confirm=="y") { + diff --git a/bureau/admin/mail_edit.php b/bureau/admin/mail_edit.php old mode 100644 new mode 100755 index 53bf9f06..442a9f5e --- a/bureau/admin/mail_edit.php +++ b/bureau/admin/mail_edit.php @@ -62,7 +62,7 @@ if (isset($error)) { ?> - + diff --git a/bureau/admin/mail_list.php b/bureau/admin/mail_list.php old mode 100644 new mode 100755 index 10cdff34..e84140de --- a/bureau/admin/mail_list.php +++ b/bureau/admin/mail_list.php @@ -77,6 +77,7 @@ if ($fatal) { cancreate("mail")) { ?> + " onClick="return false_if_empty('mail_arg', '');" /> @@ -122,6 +123,7 @@ if (empty($allmails_list) && empty($search)) { + diff --git a/bureau/admin/mem_param.php b/bureau/admin/mem_param.php old mode 100644 new mode 100755 index aa7c1591..ea6a9013 --- a/bureau/admin/mem_param.php +++ b/bureau/admin/mem_param.php @@ -78,6 +78,7 @@ echo ""; __("help_chg_passwd"); ?> + @@ -96,6 +97,7 @@ echo ""; + user["mail"]; ?> @@ -107,6 +109,7 @@ echo ""; + get_help_param()) echo "checked=\"checked\""; ?> /> @@ -120,6 +123,7 @@ if ($mem->user["su"]) { + user["admlist"]==0) echo " selected=\"selected\""; ?>> diff --git a/bureau/admin/piwik_site_dodel.php b/bureau/admin/piwik_site_dodel.php old mode 100644 new mode 100755 index 2bac3fae..6cf1bba3 --- a/bureau/admin/piwik_site_dodel.php +++ b/bureau/admin/piwik_site_dodel.php @@ -66,6 +66,7 @@ include_once('head.php'); + " /> " onclick="document.location='piwik_sitelist.php'" /> diff --git a/bureau/admin/piwik_sitelist.php b/bureau/admin/piwik_sitelist.php old mode 100644 new mode 100755 index 8714312b..8ebb7c24 --- a/bureau/admin/piwik_sitelist.php +++ b/bureau/admin/piwik_sitelist.php @@ -82,6 +82,7 @@ if ($quota->cancreate("piwik")) { ?> + "/> " /> @@ -162,6 +163,7 @@ foreach ($sitelist as $site ){ // If a site was selected if ($site_id != -1 && in_array($site_id, $piwik_alternc_sites)) { echo ''; + csrf_get(); echo ''; foreach ($piwik->get_users_access_from_site($site_id) AS $piwik_user => $cred) { printf("%s:\n\t%s\n", $piwik_user, piwik_right_widget('right', $piwik_user, $cred)); diff --git a/bureau/admin/piwik_user_dodel.php b/bureau/admin/piwik_user_dodel.php old mode 100644 new mode 100755 index 65da8d74..0c54a5e6 --- a/bureau/admin/piwik_user_dodel.php +++ b/bureau/admin/piwik_user_dodel.php @@ -64,6 +64,7 @@ include_once('head.php'); + " /> " onclick="document.location='piwik_userlist.php'" /> diff --git a/bureau/admin/piwik_useradmin.php b/bureau/admin/piwik_useradmin.php old mode 100644 new mode 100755 index 2179c5cc..a80385b5 --- a/bureau/admin/piwik_useradmin.php +++ b/bureau/admin/piwik_useradmin.php @@ -131,6 +131,7 @@ if (count($available_user_sites)>0) foreach ($available_user_sites AS $current_id_site => $available_user_site) { printf('%s + %s %s diff --git a/bureau/admin/piwik_userlist.php b/bureau/admin/piwik_userlist.php old mode 100644 new mode 100755 index 7557942b..620cb07f --- a/bureau/admin/piwik_userlist.php +++ b/bureau/admin/piwik_userlist.php @@ -40,6 +40,7 @@ if ($quota->cancreate("piwik")) { ?> + "/> " /> @@ -52,6 +53,7 @@ if ($quotapiwik['u']>0) { ?> + "/> " /> diff --git a/bureau/admin/sql_bck.php b/bureau/admin/sql_bck.php old mode 100644 new mode 100755 index ede76677..723f0792 --- a/bureau/admin/sql_bck.php +++ b/bureau/admin/sql_bck.php @@ -65,6 +65,7 @@ if (is_array($r)) { + diff --git a/bureau/admin/sql_del.php b/bureau/admin/sql_del.php old mode 100644 new mode 100755 index 71903900..893301d2 --- a/bureau/admin/sql_del.php +++ b/bureau/admin/sql_del.php @@ -75,6 +75,7 @@ if (!$found) { + get_userslist(); if($rdb){ ?> + @@ -91,6 +92,7 @@ for($i=0;$i + diff --git a/bureau/admin/sql_restore.php b/bureau/admin/sql_restore.php old mode 100644 new mode 100755 index 0f2b2e59..cb515c41 --- a/bureau/admin/sql_restore.php +++ b/bureau/admin/sql_restore.php @@ -62,6 +62,7 @@ __("Warning: Write the complete path and the filename. For example if your echo ""; ?> + " /> diff --git a/bureau/admin/sql_users_add.php b/bureau/admin/sql_users_add.php old mode 100644 new mode 100755 index a82e0cbf..209ab7bb --- a/bureau/admin/sql_users_add.php +++ b/bureau/admin/sql_users_add.php @@ -54,6 +54,7 @@ getFields($fields); } ?> + diff --git a/bureau/admin/sql_users_del.php b/bureau/admin/sql_users_del.php old mode 100644 new mode 100755 index 56a8afe0..d558984d --- a/bureau/admin/sql_users_del.php +++ b/bureau/admin/sql_users_del.php @@ -32,6 +32,7 @@ $fields = array ( "confirm" => array ("post", "string", ""), ); getFields($fields); + if(!isset($error)){ $error=""; } @@ -61,6 +62,7 @@ include_once("head.php"); + add_user($usern,$password,$passconf)) { $error=$err->errstr(); diff --git a/bureau/admin/sql_users_list.php b/bureau/admin/sql_users_list.php old mode 100644 new mode 100755 index 6fc173b9..b2eadf4a --- a/bureau/admin/sql_users_list.php +++ b/bureau/admin/sql_users_list.php @@ -47,6 +47,7 @@ if (isset($error) && $error) { if($r){ // if there is some userlist ?> + + diff --git a/bureau/admin/sql_users_rights.php b/bureau/admin/sql_users_rights.php old mode 100644 new mode 100755 index 35d98360..b235d248 --- a/bureau/admin/sql_users_rights.php +++ b/bureau/admin/sql_users_rights.php @@ -54,6 +54,7 @@ if ($r) { ?> + diff --git a/bureau/admin/vm.php b/bureau/admin/vm.php old mode 100644 new mode 100755 index 9bf93b95..6c9c3dc9 --- a/bureau/admin/vm.php +++ b/bureau/admin/vm.php @@ -68,6 +68,7 @@ include_once("head.php"); ?> + " /> @@ -85,6 +86,7 @@ include_once("head.php"); ?> + " /> diff --git a/bureau/class/config.php b/bureau/class/config.php old mode 100644 new mode 100755 index 96246879..5d4894d5 --- a/bureau/class/config.php +++ b/bureau/class/config.php @@ -209,6 +209,17 @@ if ($oldid && $oldid != $cuid) { $isinvited = true; } +// CHECK CSRF for ALL POSTS : +// you MUST add after ALL errstr(); + require_once("main.php"); + exit(); + } +} + + // Init some vars variable_get('hosting_tld', '', 'This is a FQDN that designates the main hostname of the service. For example, hosting_tld determines in what TLD the "free" user domain is created. If this is set to "example.com", a checkbox will appear in the user creation dialog requesting the creator if he wants to create the domain "username.example.com".', array('desc' => 'Wanted FQDN', 'type' => 'string')); diff --git a/bureau/class/functions.php b/bureau/class/functions.php old mode 100644 new mode 100755 index b2b8398f..0e26b24a --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -1080,14 +1080,20 @@ function panel_islocked() { * to the session cookie. We also need the $db pdo object * @return the csrf cookie to add into a csrf hidden field in your form */ -function csrf_get() { +function csrf_get($return=false) { global $db; + static $token=""; if (!isset($_SESSION["csrf"])) { $_SESSION["csrf"]=md5(rand().rand().rand()); } - $token=md5(rand().rand().rand()); - $db->query("INSERT INTO csrf SET cookie=?, token=?, created=NOW(), used=0;",array($_SESSION["csrf"],$token)); - return $token; + if ($token=="") { + $token=md5(rand().rand().rand()); + $db->query("INSERT INTO csrf SET cookie=?, token=?, created=NOW(), used=0;",array($_SESSION["csrf"],$token)); + } + if ($return) + return $token; + echo ''; + return true; } /** Check a CSRF token against the current session @@ -1096,8 +1102,11 @@ function csrf_get() { * @return $result integer 0 for invalid token, 1 for good token, -1 for expired token (already used) * if a token is invalid or expired, an $err is raised, that can be displayed */ -function csrf_check($token) { +function csrf_check($token=null) { global $db,$err; + + if (is_null($token)) $token=$_POST["csrf"]; + if (!isset($_SESSION["csrf"])) { $err->raise("functions", _("The posted form token is incorrect. Maybe you need to allow cookies")); return 0; // no csrf cookie :/ @@ -1120,6 +1129,7 @@ function csrf_check($token) { $err->raise("functions", _("Your token is expired. Please refill the form.")); return -1; // expired } - $db->query("UPDATE csrf SET used=1 WHERE cookie=? AND token=?;",array($_SESSION["csrf"],$token)); + $db->query("UPDATE csrf SET used=1 WHERE cookie=? AND token=?;",array($_SESSION["csrf"],$token)); + $db->exec("DELETE FROM csrf WHERE created
$error
"._("Permissions")."
diff --git a/bureau/admin/cron.php b/bureau/admin/cron.php old mode 100644 new mode 100755 index 1ae06b56..10f5b7fc --- a/bureau/admin/cron.php +++ b/bureau/admin/cron.php @@ -27,7 +27,7 @@ $lst_cron = $cron->lst_cron();
);" >
diff --git a/bureau/admin/mail_edit.php b/bureau/admin/mail_edit.php old mode 100644 new mode 100755 index 53bf9f06..442a9f5e --- a/bureau/admin/mail_edit.php +++ b/bureau/admin/mail_edit.php @@ -62,7 +62,7 @@ if (isset($error)) { ?>
"; __("help_chg_passwd"); ?>
";
user["mail"]; ?>
get_userslist(); if($rdb){ ?>
" />
add_user($usern,$password,$passconf)) { $error=$err->errstr(); diff --git a/bureau/admin/sql_users_list.php b/bureau/admin/sql_users_list.php old mode 100644 new mode 100755 index 6fc173b9..b2eadf4a --- a/bureau/admin/sql_users_list.php +++ b/bureau/admin/sql_users_list.php @@ -47,6 +47,7 @@ if (isset($error) && $error) { if($r){ // if there is some userlist ?>