More secure way to get the used quota, refs #814
Signed-off-by: Florian Aders (EleRas) <eleras@froxlor.org>
This commit is contained in:
@@ -472,13 +472,13 @@ while($row = $db->fetch_array($result_tasks))
|
|||||||
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task10 started - setting filesystem quota');
|
$cronlog->logAction(CRON_ACTION, LOG_INFO, 'Task10 started - setting filesystem quota');
|
||||||
|
|
||||||
# Fetch all quota in the desired partition
|
# Fetch all quota in the desired partition
|
||||||
exec($settings['system']['diskquota_repquota_path'] . " -n " . escapeshellarg($settings['system']['diskquota_customer_partition']), $repquota);
|
exec($settings['system']['diskquota_repquota_path'] . " -np " . escapeshellarg($settings['system']['diskquota_customer_partition']), $repquota);
|
||||||
|
|
||||||
$usedquota = array();
|
$usedquota = array();
|
||||||
foreach ($repquota as $tmpquota)
|
foreach ($repquota as $tmpquota)
|
||||||
{
|
{
|
||||||
# Let's see if the line matches a quota - line
|
# Let's see if the line matches a quota - line
|
||||||
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\ddays)?\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
|
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
|
||||||
{
|
{
|
||||||
# It matches - put it into an array with userid as key (for easy lookup later)
|
# It matches - put it into an array with userid as key (for easy lookup later)
|
||||||
$usedquota[$matches[1]] = array(
|
$usedquota[$matches[1]] = array(
|
||||||
|
|||||||
@@ -106,13 +106,13 @@ $db_root->close();
|
|||||||
if ($settings['system']['diskquota_enabled'])
|
if ($settings['system']['diskquota_enabled'])
|
||||||
{
|
{
|
||||||
# Fetch all quota in the desired partition
|
# Fetch all quota in the desired partition
|
||||||
exec("repquota -n " . $settings['system']['diskquota_customer_partition'], $repquota);
|
exec("repquota -np " . $settings['system']['diskquota_customer_partition'], $repquota);
|
||||||
|
|
||||||
$usedquota = array();
|
$usedquota = array();
|
||||||
foreach ($repquota as $tmpquota)
|
foreach ($repquota as $tmpquota)
|
||||||
{
|
{
|
||||||
# Let's see if the line matches a quota - line
|
# Let's see if the line matches a quota - line
|
||||||
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\ddays)?\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
|
if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches))
|
||||||
{
|
{
|
||||||
# It matches - put it into an array with userid as key (for easy lookup later)
|
# It matches - put it into an array with userid as key (for easy lookup later)
|
||||||
$usedquota[$matches[1]] = array(
|
$usedquota[$matches[1]] = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user