[horde] Quota e

Luiz Alfredo Baggiotto luiz at pucrs.br
Thu Jun 30 14:08:24 PDT 2005


Dear all

I have an horde-3.0.4 with imp-h3-4.0.3 installed in a Solaris 9 box, with php-4.3.11, courier-imap-4.0.1 and OpenLDAP base. Now, I´m trying to use the quota API to show the home user free space (because I was configured the maildir in the user´s homedir).
My imp/config/servers.php:

$servers['imap'] = array(
    'name' => 'Server',
    'server' => 'localhost',
    'hordeauth' => true,
    'protocol' => 'imap/notls',
    'port' => 143,
    'quota' => array(
        'driver' => 'command',
        'params' => array(
            'quota_path' => '/usr/sbin/quota',
            'grep_path'  => '/usr/bin/grep'
        )
    ),
    'folders' => '',
    'namespace' => '',
    'maildomain' => 'my.domain',
    'smtphost' => 'localhost',
    'smtpport' => 25,
    'realm' => 'my.domain',
    'preferred' => '',
    'dotfiles' => false,
    'hierarchies' => array()
);

I was edited the file imp/lib/Quota/command.php and changed the line 70 of the file:

70:   $cmdline = $this->_params['quota_path'] . " -u $imap_user | " .
71:              $this->_params['grep_path'] . " $homedir[1]";
72:   $junk = exec($cmdline, $quota_data, $return_code);
73:   if (($return_code == 0) && (count($quota_data) == 1)) {
74:        $quota = split("[[:blank:]]+", trim($quota_data[0]));
75:        return array('usage' => $quota[1] * 1024, 'limit' => $quota[2] * 1024);
76:   }
77:   return PEAR::raiseError(_("Unable to retrieve quota"), 'horde.error');

to

70:   $cmdline = $this->_params['quota_path'] . " -v $imap_user | " .

It´s because in Solaris the quota command has a different syntax:

# /usr/sbin/quota -v user1 | /usr/bin/grep /home
/home            22 102400 102400                  0      0      0

When I logged in horde via browser, using the "user1" account, I receive "Unable to retrieve quota". :-(
I was tested some options, but the result are ever "Unable to retrieve quota". Then I change the following line, to test the behavior of script:

73: if (($return_code == 0) && (count($quota_data) == 1)) {

to

73: if ($return_code == 1) {

and then I received the following error in browser:

Notice: Undefined offset: 0 in .../Quota/command.php on line 74
Notice: Undefined offset: 1 in .../Quota/command.php on line 75
Notice: Undefined offset: 2 in .../Quota/command.php on line 75

Seems that the array is empty, then I think that there are some problem in the unix quota command or in the expansion of $cmdline variable, but I can´t see where.
Can anyone help me? I don´t know PHP very well and the google search couldn´t help me about this problem.

Thank´s (a lot) in advance



More information about the horde mailing list