[fix] The legacy du.pl script should be replaced by /usr/bin/du in spoolsize.php

Turns out quotas were broken due to a header in du.pl

  printf "FIXME: do not work with Debian Compliance";
  exit(1);

The script is therefore unusable and useless now.
This commit is contained in:
alban 2017-10-08 09:03:06 +02:00
parent a2e6349998
commit e6377f0b98
2 changed files with 1 additions and 44 deletions

View File

@ -1,43 +0,0 @@
#!/usr/bin/perl
$ENV{PATH} = "/usr/bin:/bin";
$ENV{CDPATH} = "";
printf "FIXME: do not work with Debian Compliance";
exit(1);
$A=$ARGV[0];
sub untaint {
my @list = @_;
for (@list) {
/(.*)/;
$_ = $1;
} wantarray ? @list : $list[0];
}
$A=untaint($A);
if ($A=~/^\/var\/alternc\/html\/[a-z0-9]\//) {
open(SI,"/usr/bin/du -s '$A'|");
$B=<SI>;
$B=~/^([0-9]+).*/;
printf "$1\n";
}
if ($A=~/^\/var\/alternc\/mail\/[a-z0-9_]\//) {
open(SI,"/usr/bin/du -s '$A'|");
$B=<SI>;
$B=~/^([0-9]+).*/;
printf "$1\n";
}
if ($A=~/^\/var\/alternc\/db\//) {
open(SI,"/usr/bin/du -s '$A'|");
$B=<SI>;
$B=~/^([0-9]+).*/;
printf "$1\n";
}
if ($A=~/^\/var\/lib\/mailman\//) {
open(SI,"/usr/bin/du -s '$A'|");
$B=<SI>;
$B=~/^([0-9]+).*/;
printf "$1\n";
}

View File

@ -22,7 +22,7 @@ if ($db->query("SELECT uid,login FROM membres;")) {
} else { } else {
// The QUOTA system being disabled, we need to use 'du' on each folder. // The QUOTA system being disabled, we need to use 'du' on each folder.
$login = $db->f('login'); $login = $db->f('login');
$size=exec("/usr/lib/alternc/du.pl /var/www/alternc/".substr($login,0,1)."/".$login); $size=exec("/usr/bin/du /var/www/alternc/".substr($login,0,1)."/".$login);
} }
$db2->query("REPLACE INTO size_web SET uid=?, size=?;",array(intval($db->f('uid')),intval($size))); $db2->query("REPLACE INTO size_web SET uid=?, size=?;",array(intval($db->f('uid')),intval($size)));
echo $db->f('login')." (".(round($size/1024, 1))." MB)\n"; echo $db->f('login')." (".(round($size/1024, 1))." MB)\n";