Subject: IMAP referrals, proxy

From: David Lee <[email-masked]>
Date: Thu, 26 Oct 2000 11:01:40 +0100 (BST)

We have several Solaris 2.x boxes acting as mailspools ("/var/mail" 
INBOXs).  The software here is sendmail 8.9.x (we are moving to 8.11.1),
imap-4.7c and imap-utils.

At present each user has to know which particular mailspool has their
INBOX.  What we'd like to do, if possible, is to hide these machines
behind a single virtual service, so that the users don't need to know
which real machine hosts their INBOX.

The distribution of imap-2000-rc7 (see, I'm happy to play ball!) contains
RFC2193 and RFC2222 which talk about "Mailbox referrals" and "login
referrals".  But I cannot see any document, or anything else, which hint
at how I might begin to explore and experiment with such referrals (or
other such proxy/referral mechanisms).

Any pointers, please?

(Is this the correct forum for my question?)

-- 

:  David Lee                                I.T. Service          :
:  Systems Programmer                       Computer Centre       :
:                                           University of Durham  :
:  http://www.dur.ac.uk/~dcl0tdl            South Road            :
:                                           Durham                :
:  Phone: +44 191 374 2882                  U.K.                  :

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Thu, 26 Oct 2000 12:46:01 -0700 (PDT)

> which real machine hosts their INBOX.

The way that we do this is by a special DNS service.  User mrc knows that his
IMAP server is "mrc.deskmail.washington.edu".  The real name of this machine
may (and does!) change over time.  The DNS server for the deskmail domain is a
special version that ties into our homebrew accounting database instead of
using normal zone files.

The advantage of this is that there's no need to use referrals; a user is
always connected directly to his correct IMAP server.

> other such proxy/referral mechanisms).

At the current time, you have to build your own mechanism for the IMAP server
to consult as part of login and/or accessing a mailbox.  There's nothing built
into the IMAP server.  Just about every site has its own homebrew way of doing
this.

Once you have such a mechanism implemented, the actual mods to the IMAP server
to use that mechanism and pass back a referral are quite simple.  The client
level code fully supports referrals.

---

From: Jacob Morzinski <[email-masked]>
Date: Thu, 26 Oct 2000 16:58:46 -0400

> which real machine hosts their INBOX.

The way MIT does this is to store the user-machine pairings in
a type of DNS directory, and then modify each of our mail clients
to know to look in this directory to find out which host the
user should connect to to get their mail.  Modifying our copy
of pine to understand a "/hesiod" option to the hostname, which
instructs pine to do this "Hesiod lookup", was reasonably
straightforward.

 Jacob Morzinski                                [email-masked]

(Obscure DNS comment: no, we no longer use class Hesiod DNS queries
for these lookups.  We've switched to using class Internet queries.)

---

From: David Lee <[email-masked]>
Date: Fri, 27 Oct 2000 10:54:46 +0100 (BST)

On Thu, 26 Oct 2000, Mark Crispin wrote:

> [...]
> At the current time, you have to build your own mechanism for the IMAP
> server to consult as part of login and/or accessing a mailbox.  There's
> nothing built into the IMAP server.  Just about every site has its own
> homebrew way of doing this. 
> 
> Once you have such a mechanism implemented, the actual mods to the IMAP
> server to use that mechanism and pass back a referral are quite simple. 

I'm happy to build my own mechanism to do the user->realhost lookup.
But what hooks do I use in the IMAP server to invoke this?

[ By analogy, we happily adjust the usual flat UNIX INBOX directory
"/var/mail" (aka "/var/spool/mail") into a hierarchy, by using the hook
of "env_unix.c:sysinbox". ]

I suppose my questions are something like:

1.  Can the server, in principle, support login referrals?  And/or mailbox
    referrals?  (By analogy, it supports the principle of INBOX 
    relocation.)

2a. If so, what are the hooks to drive it?  (By analogy, the INBOX
    relocation hook is "sysinbox" in "env_unix.c".)

2b. If not, what else needs doing?  Note that I am trying to keep seperate
    the general principle (of potential use to others) from the specifics
    (of our own site's table lookup).

Just point me in the right direction (file names, function names, etc.).

> The client level code fully supports referrals.

Thanks.  That's useful and reassuring to know.

--

---

From: Mark Crispin <[email-masked]>
Date: Fri, 27 Oct 2000 10:08:09 -0700 (PDT)

> But what hooks do I use in the IMAP server to invoke this?

For login referrals, you would probably want to modify the checkpw() routine
(if you want a login failure + referral) or loginpw() routine (if you want a
login success + referral).

>     referrals?  (By analogy, it supports the principle of INBOX

Yes.

>     relocation hook is "sysinbox" in "env_unix.c".)

checkpw()/loginpw() for login referrals.

possibly mailboxfile() for mailbox referrals.

Pass up the referral with mm_log().