reopening a stream with OP_HALFOPEN

2004-12-01 Thread Tomas Pospisek's Mailing Lists
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).

Is this:
* a known problem?
* a feature with a rationale?
* fixed in c-client 2004?
Any other comment?
*t
[1] http://bugs.debian.org/257418
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux & Open Source Solutions
---
--
--
For information about this mailing list, and its archives, see: 
http://www.washington.edu/imap/c-client-list.html
--


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).
I assume that you're talking about recycling an already-open stream?
A close and open will happen if c-client determines that the new mailbox 
name is not compatible with the existing stream.

If you recycle a non-halfopen stream, and decide that you want the stream 
to be halfopen now, a close/open is required unless the server supports 
the UNSELECT capability.  That's the only reliable way to get a halfopen 
session if the server does not have UNSELECT.

If you don't care if the stream is halfopen or not, then you probably 
should not call mail_open() with the OP_HALFOPEN flag to recycle the 
stream.

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Tomas Pospisek's Mailing Lists
On Wed, 1 Dec 2004, Mark Crispin wrote:
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I've got reports [1] against Debian's version of c-client 2002e that when 
opening a stream, that is not OP_HALFOPEN (such as OP_READONLY or NIL), 
c-client will actually close and open the stream again (thus requiring the 
user to re-authenticate).
I assume that you're talking about recycling an already-open stream?
Yes.
A close and open will happen if c-client determines that the new mailbox name 
is not compatible with the existing stream.

If you recycle a non-halfopen stream, and decide that you want the stream to 
be halfopen now, a close/open is required unless the server supports the 
UNSELECT capability.  That's the only reliable way to get a halfopen session 
if the server does not have UNSELECT.

If you don't care if the stream is halfopen or not, then you probably should 
not call mail_open() with the OP_HALFOPEN flag to recycle the stream.
I'm looking at messages in readonly mode in order to determine which ones 
need to be synchronized between two sites.

Then I'm flagging those as deleted that have been removed on one side.
After that I'm appending new messages to mailboxes at both sides. In order 
to do this without having the "Status: O" set by c-client I need to change 
"down" into OP_HALFOPEN mode.

Thanks for the answer!
*t
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux & Open Source Solutions
---


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I'm looking at messages in readonly mode in order to determine which ones 
need to be synchronized between two sites.
Then I'm flagging those as deleted that have been removed on one side.
After that I'm appending new messages to mailboxes at both sides. In order to 
do this without having the "Status: O" set by c-client I need to change 
"down" into OP_HALFOPEN mode.
Thanks for explaining so clearly what you're doing.  I understand the 
issue.

If the mailbox is opened readonly then there shouldn't be any "Status: O" 
set.  c-client doesn't do this; the IMAP server does.  If one of the IMAP 
servers is UW imapd, then indeed "Status: O" will happen when messages are 
appended to a mailbox that is open readwrite, since the readwrite session 
will see the messages.  But that won't happen if it's open readonly.

So, if "Status: O" is being written then I think that must be something 
that is happening in some other server.  Or perhaps you don't really have 
the mailbox open readonly (perhaps because you don't always see new mail 
in readonly sessions).

Anyway, the correct long-term fix is to upgrade to servers that support 
UNSELECT.

-- Mark --
http://panda.com/mrc
Democracy is two wolves and a sheep deciding what to eat for lunch.
Liberty is a well-armed sheep contesting the vote.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Tomas Pospisek's Mailing Lists
On Wed, 1 Dec 2004, Mark Crispin wrote:
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
I'm looking at messages in readonly mode in order to determine which ones 
need to be synchronized between two sites.
Then I'm flagging those as deleted that have been removed on one side.
After that I'm appending new messages to mailboxes at both sides. In order 
to do this without having the "Status: O" set by c-client I need to change 
"down" into OP_HALFOPEN mode.
Thanks for explaining so clearly what you're doing.  I understand the issue.
If the mailbox is opened readonly then there shouldn't be any "Status: O" 
set.  c-client doesn't do this; the IMAP server does.  If one of the IMAP 
servers is UW imapd, then indeed "Status: O" will happen when messages are 
appended to a mailbox that is open readwrite, since the readwrite session 
will see the messages.  But that won't happen if it's open readonly.

So, if "Status: O" is being written then I think that must be something that 
is happening in some other server.  Or perhaps you don't really have the 
mailbox open readonly (perhaps because you don't always see new mail in 
readonly sessions).

Anyway, the correct long-term fix is to upgrade to servers that support 
UNSELECT.
This is not an option since the tool I maintain (mailsync) wants to 
allow the user to access all forms of mailboxes uniformly, be they IMAP 
servers with or without UNSELECT or any kind of local mailboxes...

... but - are you saying that I don't even need to change into HALFOPEN 
mode in order to be able to append messages to any kind of mailbox 
without the "Status: O" flag being set? That I just have to keep the 
stream in READONLY mode?

I seem to remember you've told me otherwise last time I asked but I can't 
dig up the mail in question (here [1] is one such email, but it doesn't 
talk about READONLY).

Thanks again,
*t
[1] http://www.mail-archive.com/c-client@u.washington.edu/msg00220.html
PS: I'd be nice to link to that searchable online archive from the UW
c-client page.
--
---
  Tomas Pospisek
  http://sourcepole.com -  Linux & Open Source Solutions
---


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
... but - are you saying that I don't even need to change into HALFOPEN mode 
in order to be able to append messages to any kind of mailbox without the 
"Status: O" flag being set? That I just have to keep the stream in READONLY 
mode?
Stream readonly status refers to operations on the opened mailbox (the 
selected mailbox in IMAP terms); it affects such operations as 
setting/clearing flags and expunging.  It does not in any way affect 
operations that work on a mailbox by name, such as append.

So I think that the answer to your question (if I understand it correctly) 
is "yes".

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: reopening a stream with OP_HALFOPEN

2004-12-01 Thread Mark Crispin
On Wed, 1 Dec 2004, Tomas Pospisek's Mailing Lists wrote:
[1] http://www.mail-archive.com/c-client@u.washington.edu/msg00220.html
That message did not consider the case of the stream being opened 
readonly.

-- Mark --
http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.