[imp] wu-imap quotas on Redhat 8 or 9 with imp 3.2.2

Lord Apollyon implist at paypc.com
Thu Sep 18 18:28:55 PDT 2003


I provided a generic solution for mapping /etc/passwd specified homedirs to
filesystem devices reported by quota -v:

The following PHP code fragment is meant to work with the already-published
"solution" on someone's (Eric's?) webpage.

I use this on production servers derived from Slackware installs originally.

=Lord Apollyon=

----- Forwarded message from Lord Apollyon <implist at paypc.com> -----


I have a probably better solution, Eric.

>>>>>>>>>>>>>>>>>>>>

$junk = exec("(grep -w $homedir[1] /etc/fstab || grep -w \"/\" /etc/fstab) |
cut -f1 -d\  | cut -f1", $my_device, $return_code); // All one line

if ($return_code === 0 && $my_device === 1) //newline
$junk = exec("/usr/local/phpbin/sudo /usr/bin/quota -u $imap_admin | grep
$my_device[0]", $quota_data,$return_code);   // All one line

<<<<<<<<<<<<<<<<<<<<

This will map the homedir fragment to a device entry - which is what
Slackware quota -u's report.  The logic's simple - if the first /frag isn't
matched in the fstab, then / is assumed as the filesystem.  The device entry
of the best-matched fs is returned, and pumped into the subsequent grep
command.  Oh happy shelliness.

You could just gobble the /etc/fstab and parse it in PHP (which might be
faster because shell forking is more costly than simple execution), however,
you'd run afoul of things if you used Safe Mode, whereas doing it via shell
has an easy Safe Mode accomodation.

=Apollyon=

----- End forwarded message -----





More information about the imp mailing list