[Dovecot] Minor bugs still in test77

Chris Wakelin c.d.wakelin at reading.ac.uk
Wed Jul 13 18:49:44 EEST 2005


Thinking of patches I always apply, I've got a couple (attached) that 
fix minor bugs and maybe should be applied - or implemented better and 
then applied ;) - to the main distribution?

1) LIST bugs:

LIST "~/mail/" ""

and

LIST "" "~/mail/"

(where "~/mail/" is a namespace prefix) don't reply the same way as 
UW-IMAP does and in at least the first case, still violates the spec 
(your fix breaks, as namespace_find() modifies its argument)

The second issue breaks Pine 4.x, I think.

2) Angle-addresses

If a header address is just "<someone at somewhere.org>" rather than 
"Someone <someone at somewhere.org>" or "someone at somewhere.org", then the 
FETCH ... ENVELOPE command responds with "" as the personal name, rather 
than NIL, which may confuse clients (without being wrong, technically, I 
think).

(In case anyone's interested, I also use patches to:

1) fix the 64bit issue mentioned earlier today
2) introduce extra logging of LIST, SUBSCRIBE and UNSUBSCRIBE (for 
debugging during our migration from UW-IMAP)
3) rename .subscriptions to .mailboxlist and store folder names in it 
including the namespace prefix (to emulate UW-IMAP)
4) implement a Reading-specific hashing algorithm for the mail spool 
location as an extra variable modifier "%H" (e.g. 
"/export/mail/%Hu/%u/INBOX")
5) remove the need for /dev/urandom, which isn't available on our mail 
server (though there is a Solaris patch available to create it).
6) add an option to hide "AUTH=PLAIN" in the CAPABILITY string as Pine 
4.x complains loudly when this is advertised on a non-SSL connection

)

Best Wishes,
Chris

-- 
--+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-
Christopher Wakelin,                           c.d.wakelin at reading.ac.uk
IT Services Centre, The University of Reading,  Tel: +44 (0)118 378 8439
Whiteknights, Reading, RG6 2AF, UK              Fax: +44 (0)118 975 3094
-------------- next part --------------
--- dovecot-1.0-test77.orig/src/imap/cmd-list.c	Sun Apr 17 17:37:05 2005
+++ dovecot-1.0-test77/src/imap/cmd-list.c	Wed Jul 13 16:10:27 2005
@@ -372,7 +372,8 @@
 		   concept which probably no other client uses than Pine.
 		   Just try our best to emulate UW-IMAP behavior and hopefully
 		   we're fine. */
-		ns = namespace_find(client->namespaces, &ref);
+		const char *ref_copy = t_strdup(ref);
+		ns = namespace_find(client->namespaces, &ref_copy);
 		if (ns == NULL) {
 			const char *empty = "";
 			ns = namespace_find(client->namespaces, &empty);
@@ -405,6 +406,28 @@
 		}
 		client_send_tagline(cmd, "OK List completed.");
 	} else {
+
+		if (*ref == '\0' && !lsub) {
+			/* LIST "" "something" */
+			const char *mask_copy = t_strdup(mask);
+			ns = namespace_find(client->namespaces, &mask_copy);
+			if (ns == NULL) {
+				const char *empty = "";
+				ns = namespace_find(client->namespaces, &empty);
+			}
+			if (*ns->prefix != '\0' && *mask_copy == '\0') {
+				/* namespace, return it */
+				string_t *str = t_str_new(64);
+				str_printfa(str, "* LIST (\\Noselect) \"%s\" ",
+				    ns->sep_str);
+				imap_quote_append_string(str, ns->prefix,
+							 FALSE);
+				client_send_line(client, str_c(str));
+				client_send_tagline(client, "OK List completed.");
+				return TRUE;
+			}
+		}
+
 		ctx = p_new(cmd->pool, struct cmd_list_context, 1);
 		ctx->ref = ref;
 		ctx->mask = mask;
-------------- next part --------------
--- dovecot-1.0-test77.orig/src/lib-mail/message-address.c	Fri Apr  8 12:16:36 2005
+++ dovecot-1.0-test77/src/lib-mail/message-address.c	Wed Jul 13 16:15:15 2005
@@ -140,6 +140,10 @@
 		return -1;
 
 	ctx->addr.name = p_strdup(ctx->pool, str_c(ctx->str));
+	if (*ctx->addr.name == '\0') {
+		/* Cope with "<address>" without display name */
+		ctx->addr.name = NULL;
+	}
 	if (parse_angle_addr(ctx) < 0) {
 		/* broken */
 		ctx->addr.domain = p_strdup(ctx->pool, "SYNTAX_ERROR");


More information about the dovecot mailing list