[imp] [Fwd: Error message of "Unable to retrieve quota" from IMP]

edwardspl at ita.org.mo edwardspl at ita.org.mo
Sun Apr 5 06:55:18 UTC 2009



-------- Original Message --------
Subject: 	Error message of "Unable to retrieve quota" from IMP
Date: 	Sun, 05 Apr 2009 14:41:08 +0800
From: 	edwardspl at ita.org.mo
To: 	IMP <imp at lists.horde.org>
CC: 	horde at lists.horde.org <horde at lists.horde.org>



Dear All,

Mine is Linux FC6 ( Include Apache Web Server ), WebMail Client ( IMP
4.1.5, Horde 3.1.5 ).

The Quota display function can't be good for work as the following link:
http://img124.imageshack.us/img124/1928/impquotafunction.jpg

For our config setting:

horde/imp/config/servers.php

$servers['cyrus'] = array(
'name' => 'Mail Server',
'server' => 'xxx.xxx.xxx.xxx',
'hordeauth' => false,
'protocol' => 'imap/notls',
'port' => 143,
'maildomain' => 'xxx.xxx.xxx',
'smtphost' => 'xxx.xxx.xxx.xxx',
'smtpport' => 25,
'realm' => '',
'preferred' => '',
'quota' => array(
'driver' => 'command',
'params' => array(
'quota_path' => '/usr/bin/quota',
'grep_path' => '/bin/grep'
)
),
);

command.php :

function IMP_Quota_command($params = array())
{
$this->_params = array(
'quota_path' => 'sudo quota',
'grep_path' => 'sudo grep',
'partition' => null
);

$this->_params = array_merge($this->_params, $params);
}

function getQuota()
{
$imap_user = $_SESSION['imp']['user'];
if (empty($this->_params['partition'])) {
$passwd_array = posix_getpwnam($imap_user);
list($junk, $search_string, $junk) = explode('/', $passwd_array['dir']);
} else {
$search_string = $this->_params['partition'];
}
$cmdline = $this->_params['quota_path'] . ' -u ' . $imap_user . ' | ' .
$this->_params['grep_path'] . ' ' . $search_string;
exec($cmdline, $quota_data, $return_code);
if (($return_code == 0) && (count($quota_data) == 1)) {
$quota = split("[[:blank:]]+", trim($quota_data[0]));
$blocksize = $this->blockSize();
return array('usage' => $quota[1] * $blocksize,
'limit' => $quota[2] * $blocksize);
}
return PEAR::raiseError(_("Unable to retrieve quota"), 'horde.error');
}


sudo ( sudo-1.6.8p12-10 ) :

Host_Alias MH= itahost1
User_Alias WEB = nobody
Cmnd_Alias WEBADMIN = /usr/bin/quota, /bin/grep
WEB MH = NOPASSWD: WEBADMIN

Under the Linux ENV :
[manager at svr1 ~]$ sudo quota -u edward
Disk quotas for user edward (uid 500):
Filesystem blocks quota limit grace files quota limit grace
/dev/sda2 1720 0 10240 1 0 0
[manager at svr ~]$ ls -l -h /var/spool/mail/edward
-rw------- 1 edward mail 1.7M Apr 5 14:30 /var/spool/mail/edward

So, what config mistake I have ?
Would you mind to help to solve the problem of "Unable to retrieve quota" ?

Thank !

Edward.




More information about the imp mailing list