On Wed, 19 Jul 2006, Johannes Berg wrote:
On Wed, 2006-07-19 at 15:49 +0100, David Lee wrote:
Is there some means in the "dovecot.conf" file to specify an INBOX pattern as "/var/spool/mail/%ZZZ%/%u" where "%ZZZ%" could be algorithmically specified as (say) "user-uid mod 100"?
If all your uids are a fixed number of digits you could do default_mail_env = /var/spool/mail/%3.2i/%u (if all uids are 5 digits long)
Close. But not quite, I think. Our significant uids range from about 1,000 to about 60,000. So they are a mix of four- and five-digit, not a fixed number of digits.
Both "2345" and "12345" need to map onto the same result: "45". But I gather (although I'm new to dovecot) that the "%3.2i" notation acts on the uid as a string rather than as a number, therefore would yield different values.
Background: This exercise is to do a minimally invasive black-box replacement of UW-IMAP with Dovecot. We are trying to avoid any major reworking of our directory structure. (The longer-term strategy at our site is Exchange (don't ask!); this proposed UW->dovecot work on the existing service is a temporary "get us by for the moment" fix.)
The closest other scheme based on UIDs I can think of is %.2Ri, which gives you the last two digits of the UID (i.e. uid mod 100) but in reverse, so for uid 1234 it'd give you 43.
From "1234" I'd need "34" as the answer. And from "1204" (and "12304") I'd need "04" including its leading "0". ("1200"->"00" etc.)
Depending on what other tools you use, you could also use the hash (H) modifier, but maybe your delivery agent can't do that (unless of course you plan to use dovecot-lda too)
With our UW set-up, everything goes through UW's c-client library (sendmail local delivery through UW's "tmail"). So "dovecot-lda" (which I've not yet investigated) would probably be the natural route for us.
Perhaps I should further investigate the "%H"-like stuff (which seems to be hex rather than base-10) to see whether I can do a generalised extension which could enable a base-10 modulo thing, including leading zeroes. Or a "final n-char substring" thing. (Naturally, I'd take advice, and would hope to feed back any patch.)
--
: David Lee I.T. Service : : Senior Systems Programmer Computer Centre : : Durham University : : http://www.dur.ac.uk/t.d.lee/ South Road : : Durham DH1 3LE : : Phone: +44 191 334 2752 U.K. :