[Dovecot] Dovecot 1.0.x and NFS-mounted mailstore quotas
Mike Brudenell
pmb1 at york.ac.uk
Tue Jul 31 19:18:33 EEST 2007
Greetings -
On 30 Jul 2007, at 10:05, Joseba Torre wrote:
> Could you share it please? As previously reported, the "official"
> patch is not
> working right now.
>
> Aaaaaaaaaaagur.
I'm attaching the patch files and a tar archive that comprise the
changes I use to support reading quotas from NFS-mounted filestore.
The patches are against the Dovecot 1.0.2 source code.
The files within the rpc-quota.tar.gz archive in an old posting to a
NetApp filers list; they form a sample means of querying the rquotad
on the filer.
It assumes you have the command "rpcgen" on your system to process
the supplied rquota.x file and produce the associated include files.
So it's not quite just applying the patches, but is very simple; just
save the attached files somewhere and follow the steps below to apply
them...
mountpoint.c
This is a patch Timo put out on the list a week or so back
following my
problems skipping over filestores with the "ignore" options set.
I've used
this on our non-production server and have found it fine. You may
need it
if you are using the automounter, otherwise the NFS quota code may
end up
operating on the automount template point rather than the real
mounted
directory.
cd src/lib
gpatch <mountpoint.c
The remaining three files are all for the quota plugin directory, so
start off by going there:
cd src/plugins/quota
rpc-quota.tar.gz
This is a GZipped tar archive containing a directory to be
unpacked here. The
directory contains the rquota.x and Makefile from the sample code
I found. It
also includes my own rpc-quota.h and rpc-quota-code.c files: these
get
included in quota-fs.c by one of the patches below.
gzcat rpc-quota.tar.gz | tar xvf -
Now move down into the rpc-quota directory you've just unpacked
and generate
the other include files you need using rpcgen:
cd rpc-quota
gmake
cd ..
quota-fs.c
This is a patch that first includes the rpc-quota/rpc-quota.h
file, which
includes some header files and define the fetchnfsquotas() we'll
be using.
It also changes the code that attempts to get the quota from a
locally mounted
filesystem. If this wasn't possible (root->mount->fd == -1)
instead of
returning, call the code included from rpc-quota/rpc-quota-code.c
to check for
a ":" in the path and, if found, use an RPC to get the quota from
the NFS
server.
gpatch <quota-fs.c
quota.c
Strictly speaking you don't need this patch, although I would
suggest it.
When preparing the quotaroot name this change checks if the name
would be
the empty string and, if it is, replaces it with the username
obtained by
calling getpwuid(getuid()). Without this patch Apple's "Mail"
program
recognises the server supports quotas (from the capability
string), but
does not show their values or draw the bar-chart. Basically it
will only
do so if the quotaroot name is non-empty. [The IMAP specification
allows
for empty -- "" -- quotaroot names, so Apple's Mail client is
technically
in violation.]
gpatch <quota.c
You'll get output looking something like this:
% gmake
rpcgen -o rquota.h -h rquota.x
cc -O -g -DSUNOS5 -c -o quotatest.o quotatest.c
rpcgen -o rquota_xdr.c -c rquota.x
cc -O -g -DSUNOS5 -c -o rquota_xdr.o rquota_xdr.c
rpcgen -o rquota_clnt.c -l rquota.x
cc -O -g -DSUNOS5 -c -o rquota_clnt.o rquota_clnt.c
cc -o quotatest quotatest.o rquota_xdr.o rquota_clnt.o -
lsocket -lnsl
Don't worry unduly about the -DSUNOS5 macro being defined: that is
for the
quotatest test program, and doesn't seem to be for the files
generated by
rpcgen (I think!).
That should be everything: just recompile, install and hope!
You can test it by connecting to your IMAP server and giving a
QUOTAROOT command:
telnet imap.yourdomain.tld 143
a01 login yourusername yourpassword
a02 getquotaroot inbox
...output appears here...
a03 logout
You should get output that looks something like this:
a02 getquotaroot inbox
* QUOTAROOT "inbox" "pmb1"
* QUOTA "pmb1" (STORAGE 71260 102400)
a02 OK Getquotaroot completed.
Then give it a go for real.
If you find it doesn't work don't give up hope yet. Instead rummage
through your /usr/include directory tree looking for your own
system's rquota.x file; then try it instead of the one I've included.
Finally, remember that the files in the rpc-quota directory aren't
included in Dovecot's own Makefiles. So if you change any of them
you'll need to update the timestamp of the quota-fs.c plugin before
make will notice the change and recompile it:
touch src/plugins/quota/quota-fs.c
Cheers,
Mike B-)
--
The Computing Service, University of York, Heslington, York Yo10 5DD, UK
Tel:+44-1904-433811 FAX:+44-1904-433740
* Unsolicited commercial e-mail is NOT welcome at this e-mail address. *
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mountpoint.c
Type: application/octet-stream
Size: 1519 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070731/c4ffd8b4/attachment-0003.obj
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rpc-quota.tar.gz
Type: application/x-gzip
Size: 4003 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070731/c4ffd8b4/attachment-0001.gz
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quota-fs.c
Type: application/octet-stream
Size: 530 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070731/c4ffd8b4/attachment-0004.obj
-------------- next part --------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: quota.c
Type: application/octet-stream
Size: 888 bytes
Desc: not available
Url : http://dovecot.org/pipermail/dovecot/attachments/20070731/c4ffd8b4/attachment-0005.obj
-------------- next part --------------
More information about the dovecot
mailing list