🔒 ♻️ Implement secure exec wrapper functions.

This commit is contained in:
Flat 2015-12-02 21:24:34 +09:00
commit 8e951ac72e
115 changed files with 1345 additions and 1986 deletions

View file

@ -3,13 +3,12 @@
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
if ($_SESSION['user'] == 'admin') {
exec (VESTA_CMD."v-add-cron-vesta-autoupdate", $output, $return_var);
v_exec('v-add-cron-vesta-autoupdate', [], false);
$_SESSION['error_msg'] = __('Autoupdate has been successfully enabled');
unset($output);
}
header("Location: /list/updates/");
header('Location: /list/updates/');
exit;

View file

@ -13,7 +13,7 @@ if (!empty($_POST['ok'])) {
// Check token
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
header('location: /login/');
exit();
exit;
}
// Check empty fields
@ -35,18 +35,16 @@ if (!empty($_POST['ok'])) {
}
// Protect input
$v_min = escapeshellarg($_POST['v_min']);
$v_hour = escapeshellarg($_POST['v_hour']);
$v_day = escapeshellarg($_POST['v_day']);
$v_month = escapeshellarg($_POST['v_month']);
$v_wday = escapeshellarg($_POST['v_wday']);
$v_cmd = escapeshellarg($_POST['v_cmd']);
$v_min = $_POST['v_min'];
$v_hour = $_POST['v_hour'];
$v_day = $_POST['v_day'];
$v_month = $_POST['v_month'];
$v_wday = $_POST['v_wday'];
$v_cmd = $_POST['v_cmd'];
// Add cron job
if (empty($_SESSION['error_msg'])) {
exec (VESTA_CMD."v-add-cron-job ".$user." ".$v_min." ".$v_hour." ".$v_day." ".$v_month." ".$v_wday." ".$v_cmd, $output, $return_var);
check_return_code($return_var,$output);
unset($output);
v_exec('v-add-cron-job', [$user, $v_min, $v_hour, $v_day, $v_month, $v_wday, $v_cmd]);
}
// Flush field values on success
@ -58,7 +56,6 @@ if (!empty($_POST['ok'])) {
unset($v_month);
unset($v_wday);
unset($v_cmd);
unset($output);
}
}

View file

@ -3,11 +3,10 @@
error_reporting(NULL);
ob_start();
session_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
include($_SERVER['DOCUMENT_ROOT'].'/inc/main.php');
exec (VESTA_CMD."v-add-cron-reports ".$user, $output, $return_var);
v_exec('v-add-cron-reports', [$user], false);
$_SESSION['error_msg'] = __('Cronjob email reporting has been successfully enabled');
unset($output);
header("Location: /list/cron/");
header('Location: /list/cron/');
exit;