Thursday, October 13, 2005
Cyrus FUD
A while back, Pierre was trying to add
users' mailbox information (new message count, etc) to the studentzone. He had some
hair-brained scheme that involved caching the users password clear-text in a
cookie. There had to be a better way to do this ...
Last night, whilst trying to tidy up the over quota message users get from
our mail server, I came across
fud. fud is a
part of the
Cyrus IMAP
server that we'd never used — it implements a simple UDP daemon
that allows access to just the sort of information Pierre was looking for.
(It's intended for use in finger-like applications.)
The problem was that I couldn't find a PHP
implementation of the client — the studentzone is written in PHP
and it'd be nice to just hook into a function. I also couldn't find any
documentation of how the protocol worked (all Cyrus says is that it's
likely to change). Undaunted, I found a Perl implementation by Jason Englander. This
gave me enough clues about the protocol to work on a PHP version.
The result is cyrus_fud(), a PHP
function that implements the client portions of Cyrus' fud. It usefully
returns an array of all the data fud spits out. YMMV and all that. There's
some simple documentation at the top of the file.
The only other problem I had was that fud requires all Cyrus mailboxes to
have the 0 (zero) ACL set for the anonymous user. So far as I can tell,
this ACL is only used by fud, so that didn't seem a problem. I did,
however, have to retrofit the ACL to eight thousand existing mailboxes.
Some perl solved this for
me. It uses the Cyrus::IMAP::Admin Perl module to get a list of
mailboxes and set the required ACL on them. YMMV again ;-)
posted by guy at: 17:02 SAST |
path: /systems |
permanent link
