[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pop3d and imap4d's locking behaviour
From: |
Sam Roberts |
Subject: |
Re: pop3d and imap4d's locking behaviour |
Date: |
Sat, 2 Mar 2002 00:56:23 -0500 |
User-agent: |
Mutt/1.3.16i |
Ok, 1 bug in mbx_mboxscan.c (wasn't checking return value
of locker_lock()) fixed.
IMAP's SELECT doesn't check mailbox return values either,
this seems to work (in that select now fails if the mailbox
can't be locked), but it modifies global state so I don't
want to apply it, and there are other callers of this
function that should likely check its status.
But its late and I have to go to bed.
Cheers,
Sam
Index: imap4d.h
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/imap4d.h,v
retrieving revision 1.32
diff -u -r1.32 imap4d.h
--- imap4d.h 27 Feb 2002 12:02:52 -0000 1.32
+++ imap4d.h 2 Mar 2002 05:52:23 -0000
@@ -169,7 +169,7 @@
extern int imap4d_search0 __P((char *arg, int isuid, char *replybuf, size_t
replysize));
extern int imap4d_select __P ((struct imap4d_command *, char *));
extern int imap4d_select0 __P ((struct imap4d_command *, char *, int));
-extern void imap4d_select_status __P((void));
+extern int imap4d_select_status __P((void));
extern int imap4d_status __P ((struct imap4d_command *, char *));
extern int imap4d_store __P ((struct imap4d_command *, char *));
extern int imap4d_store0 __P ((char *, int, char *, size_t));
Index: select.c
===================================================================
RCS file: /cvsroot/mailutils/mailutils/imap4d/select.c,v
retrieving revision 1.19
diff -u -r1.19 select.c
--- select.c 27 Feb 2002 11:54:47 -0000 1.19
+++ select.c 2 Mar 2002 05:52:23 -0000
@@ -80,44 +80,52 @@
if (!mailbox_name)
return util_finish (command, RESP_NO, "Couldn't open mailbox");
- if (mailbox_create (&mbox, mailbox_name) == 0
- && mailbox_open (mbox, flags) == 0)
+ if ((status = mailbox_create (&mbox, mailbox_name)) == 0
+ && (status = mailbox_open (mbox, flags)) == 0
+ )
{
- free (mailbox_name);
select_flags = flags;
state = STATE_SEL;
- imap4d_select_status();
+ if ((status = imap4d_select_status ()) == 0)
+ {
+ free (mailbox_name);
/* Need to set the state explicitely for select. */
- return util_send ("%s OK [%s] %s Completed\r\n", command->tag,
- (MU_STREAM_READ == flags) ?
- "READ-ONLY" : "READ-WRITE", command->name);
+ return util_send ("%s OK [%s] %s Completed\r\n", command->tag,
+ (MU_STREAM_READ == flags) ?
+ "READ-ONLY" : "READ-WRITE", command->name);
+ }
}
- status = util_finish (command, RESP_NO, "Couldn't open %s", mailbox_name);
+ status = util_finish (command, RESP_NO, "Couldn't open %s, %s",
+ mailbox_name, mu_errstring (status));
free (mailbox_name);
return status;
}
/* The code is shared between select and noop */
-void
-imap4d_select_status()
+int
+imap4d_select_status ()
{
const char *mflags = "\\Answered \\Flagged \\Deleted \\Seen \\Draft";
const char *pflags = "\\Answered \\Deleted \\Seen";
unsigned long uidvalidity = 0;
size_t count = 0, recent = 0, unseen = 0, uidnext = 0;
+ int status = 0;
if (state != STATE_SEL)
- return;
+ return 0; /* FIXME: this should be something! */
+
+ if (
+ (status = mailbox_uidvalidity (mbox, &uidvalidity)) ||
+ (status = mailbox_uidnext (mbox, &uidnext)) ||
+ (status = mailbox_messages_count (mbox, &count)) ||
+ (status = mailbox_messages_recent (mbox, &recent)) ||
+ (status = mailbox_message_unseen (mbox, &unseen))
+ )
+ return status;
- mailbox_uidvalidity (mbox, &uidvalidity);
- mailbox_uidnext (mbox, &uidnext);
- mailbox_messages_count (mbox, &count);
- mailbox_messages_recent (mbox, &recent);
- mailbox_message_unseen (mbox, &unseen);
util_out (RESP_NONE, "%d EXISTS", count);
util_out (RESP_NONE, "%d RECENT", recent);
- util_out (RESP_OK, "[UIDVALIDITY %d] UID valididy status",
- uidvalidity);
+ util_out (RESP_OK, "[UIDVALIDITY %d] UID valididy status", uidvalidity);
util_out (RESP_OK, "[UIDNEXT %d] Predicted next uid", uidnext);
if (unseen)
util_out (RESP_OK, "[UNSEEN %d] first unseen messsage ", unseen);
@@ -129,4 +137,7 @@
util_out (RESP_OK, "[PERMANENTFLAGS ()] No Permanent flags");
else
util_out (RESP_OK, "[PERMANENTFLAGS (%s)] Permanent flags", pflags);
+
+ return 0;
}
+
- pop3d and imap4d's locking behaviour, Sam Roberts, 2002/03/01
- Re: pop3d and imap4d's locking behaviour, Sam Roberts, 2002/03/01
- Re: pop3d and imap4d's locking behaviour,
Sam Roberts <=
- Re: pop3d and imap4d's locking behaviour, Alain Magloire, 2002/03/02
- Re: pop3d and imap4d's locking behaviour, Sam Roberts, 2002/03/02
- Re: pop3d and imap4d's locking behaviour, Alain Magloire, 2002/03/02
- Message not available
- Re: pop3d and imap4d's locking behaviour, Sam Roberts, 2002/03/03
- Re: pop3d and imap4d's locking behaviour, Alain Magloire, 2002/03/03
- Message not available
- Re: pop3d and imap4d's locking behaviour, Sam Roberts, 2002/03/04
- Re: pop3d and imap4d's locking behaviour, Alain Magloire, 2002/03/05