Subject: two things

From: [email-masked] (Mark J. Bailey [HOME])
Date: Wed, 4 Oct 1995 15:42:04 -0500 (CDT)

hi

how do you test for a given mailbox as already being SELECTed (or I should 
say mail_open()'ed)?  just try mail_open() and test return status?

also, if I authenticate ONCE during a given session (such as the first
mail_open()), will I be forced to authenticate again at any other time
if I am using the same IMAP server for the duration of the session?  Ie,
i assume that if I mail_open() for the first time that mm_login() will be
called as I am probably not authenticated.  i further assume that subseqent
mail_open()'s are preauthenticated (same imap server).  what happens if
I happen to mail_close() all folders mid-session, then later want to 
mail_open() another (again, same server)?  will I have to deal with mm_login()
again?

thanks!

Mark

---

From: Mark Crispin <[email-masked]>
Date: Wed, 4 Oct 1995 14:03:38 -0700 (PDT)

> say mail_open()'ed)?  just try mail_open() and test return status?

No, you have to keep track of it in your application.  There is no guarantee
of what will happen if you open a folder that is already open in the same
application.  Sometimes it will work, sometimes it will give you restricted
access (e.g. expunge not available) in both streams, sometimes it will cause a
"kiss of death" (SIGUSR2) signal to be sent to your application.

> mail_open() another (again, same server)?  will I have to deal with
> mm_login() again?

Remember, c-client is stateless.

If you open a stream, and you use that stream as the oldstream argument to
mail_open() to open another folder, if the host name matches it is quite
likely that it will just issue another IMAP SELECT operation and thus you
won't need to authenticate.  Note that doing this has the effect of closing
whatever folder you had open on oldstream.

If, on the other hand, c-client decides that it needs a new IMAP connection,
or if you don't give it an oldstream argument, it will make a fresh connection
which will need fresh authentication.

Pre-authentication happens only when you open a new server connection; if you
can do "rsh server /etc/rimapd" and get back a "* PREAUTH" it will use the
pipes to the rsh as an IMAP connection instead of opening a TCP connection to
port 143.  Pre-authentication is not relevant to what you are asking.

So yes, you will have to deal with mm_login().  If you want any memory of
authentication credentials, you have to implement it yourself in your
application, and deal with whatever security risks you may have by leaving
authentication credentials lying around.