Subject: read only #public?

From: David Henry <[email-masked]>
Date: Thu, 19 Mar 1998 11:29:23 -0500 (EST)

I am having trouble getting imap4rev1 V10.220 to open a folder which is 
read-only.  My sense is that I should get a successful but [READ-ONLY] 
response when an attempt is made to open a folder which is unwriteable 
by the server (not only for #public, but also for #shared, ~/whatever, 
etc.).  Since I want to make some folders available to everyone, and 
have them readonly, using #public with readonly files seemed like the 
logical approach. I haven't tried earlier versions of the server. 

So, is the server broken?  Or, perish the thought, is it my thinking?

Thanks,

David Henry
University of Maryland 

* OK umailsrv0.umd.edu IMAP4rev1 v10.220 server ready
a login uid xxxxxxx
a OK LOGIN completed

b list "" #public/%
* LIST (\NoSelect) "/" #public/
* LIST (\NoInferiors \UnMarked) "/" #public/cscnews
* LIST (\NoInferiors \Marked) "/" #public/umailnews
b OK LIST completed

####changed permission to enable write in another window
####the directory is drwxr-xr-x,
####the mbox style files are now -rw-rw-rw-

c select #public/cscnews
* 51 EXISTS
* OK [UIDVALIDITY 890259435] UID validity status
* OK [UIDNEXT 52] Predicted next UID
* FLAGS (\Answered \Flagged \Deleted \Draft \Seen)
* OK [PERMANENTFLAGS (\* \Answered \Flagged \Deleted \Draft \Seen)] Permanent flags
* OK [UNSEEN 1] 1 is first unseen message in /usr/local/umail/imappublic/cscnews
* 0 RECENT
c OK [READ-WRITE] SELECT completed

d logout
* BYE umailsrv0.umd.edu IMAP4rev1 server terminating connection
d OK LOGOUT completed

---

From: Mark Crispin <[email-masked]>
Date: Thu, 19 Mar 1998 10:58:25 -0800 (PST)

On Thu, 19 Mar 1998 11:29:23 -0500 (EST), David Henry wrote:
> read-only.

I don't understand your question.  Why do you expect to get READ-ONLY if the
folder is protected -rw-rw-rw-?

What happens from a SELECT if you protect the folder -rw-r--r--?

---

From: David Henry <[email-masked]>
Date: Thu, 19 Mar 1998 14:56:04 -0500 (EST)

> What happens from a SELECT if you protect the folder -rw-r--r--?

Whoops!  In the process of preparing the message I managed to delete 
the most critical part of the transcript.

What happens when the file is -rw-r--r-- is this:

c select #public/cscnews
c NO SELECT failed: Mailbox open failed, aborted: Permission denied

---

From: Mark Crispin <[email-masked]>
Date: Thu, 19 Mar 1998 12:29:38 -0800 (PST)

> c NO SELECT failed: Mailbox open failed, aborted: Permission denied

OK, this means that the mailbox was opened read/write, and then upon trying to
parse it it discovered that it couldn't get read/write access.  This is
supposedly not possible, because of an earlier check:
  if ((LOCAL->ld >= 0) && access (LOCAL->name,W_OK) && (errno == EACCES)) {
which sets readonly if this condition is true.

This means that either access() returned 0 (success) or that the errno check
didn't match.  Both are unlikely; the former would be an operating system bug,
and in the latter EACCES is "Permission denied".

This problem does not happen on my development system!  [NeXT workstations]

However, I have had some circumstantial evidence in the past that errno
comparisons don't work in some versions of Digital Unix; or rather, there have
been strange events that could only be explained if an errno comparison didn't
work.  This wouldn't be the first time that DU compiler bugs have been
implicated; the infamous "Netscape can't log in to UW imapd running on DU"
problem turned out to be that the DU 4.x compiler generated bad code for a
switch of a post-decremented short.

If you are using a DU system, try a build with "EXTRACFLAGS=-oldc" and see if
it works any better.

---

From: David Henry <[email-masked]>
Date: Fri, 20 Mar 1998 16:08:07 -0500 (EST)

Yes, I am running on Digital Unix 4.0.  Adding -oldc didn't help, but 
building the osf version (as opposed to os4) seemed to do the trick.  
As near as I can tell, the primary difference between osf and os4 is 
the use of the SIA (Security Integration Architecture) routines for 
userid/password verification and setuid.  Since I am using simple BSD 
style authentication, I don't need the SIA stuff. 

I have discovered that when opening the server "PREAUTH", the 
select correctly opens the folder readonly.  Clearly, the SIA 
routines are not called in this case. 

When I find myself with some more time, I will spend some more time 
on it to see if I can nail it down further, but for now, I am happy. 

Thanks for your help.

David

---

From: Mark Crispin <[email-masked]>
Date: Fri, 20 Mar 1998 13:47:31 -0800 (PST)

Do you have the latest version of log_os4.c, dated 17 February 1998?  If not,
please try with the version.  For your convenience, I'm attaching the latest
source file, so you can try it in your copy without upgrading everything else.

I don't understand why it should have made any difference if you have world
read (-rw-r--r--) set.

---

From: David Henry <[email-masked]>
Date: Fri, 20 Mar 1998 17:09:01 -0500 (EST)

I do have the latest version of this file (I just diff'd them to be 
sure). I am working with version 220, which I downloaded March 17. 

David

---

From: Mark Crispin <[email-masked]>
Date: Fri, 20 Mar 1998 14:27:38 -0800 (PST)

> sure). I am working with version 220, which I downloaded March 17.

OK, thanks.  Does it work to build with LOGINPW set to sec instead of os4 in
the c-client Makefile?

---

From: David Henry <[email-masked]>
Date: Fri, 20 Mar 1998 18:24:43 -0500 (EST)

> OK, thanks.  Does it work to build with LOGINPW set to sec instead of os4 in
I just rebuilt the server with the above change, and, YES, it does 
work!   I don't see anything wrong with the sia_become_user call in 
log_os4.c (at least as far as I can tell from info in the man pages).

David

---

From: Mark Crispin <[email-masked]>
Date: Fri, 20 Mar 1998 15:33:09 -0800 (PST)

OK, thanks.  I'll make LOGINPW=sec be the standard.  DEC was insistant that I
use the SIA routines, but it seems that they don't really work.  We've had
problems with them here too.