Murder + Sieve + multiple backends problem

Wesley Craig wes at umich.edu
Tue Dec 9 14:26:56 EST 2008


On 02 Dec 2008, at 10:54, Juergen Wolf wrote:
> The mlookup
> thing is indeed very simple and already working. The cmd_append() part
> is a bit tricky tho, as the LMTPD does not have any imap connection to
> the backend as far as I see. I guess LMTP will be the wrong way to
> transport the mail to the right backend server.

Right, you'd want an IMAP connection, I would think.

> +    /* Mailbox not existent, and murder setup ? */
> +    if (r == IMAP_MAILBOX_NONEXISTENT && config_mupdate_server) {
> +      /* check the mupdate master */

You don't really want to talk to the mupdate master.  You want to  
look in the local mailboxes.db (this only works in a unified murder,  
obviously).

If you look at cmd_append() in imapd.c, you see mlookup() used to  
obtain mailbox information.  sieve_fileinto() in lmtp_sieve.c is  
structurally similar: it internalizes the mailbox, and then delivers  
it.  The deliver_mailbox() in lmtpd.c is just an append, just like  
cmd_append() is!  At least the part after:

	/* local mailbox */

in cmd_append() is analogous to the append code in deliver_mailbox 
().  The portion of cmd_append() that's missing from deliver_mailbox 
() is the first bit:

     if (!r && (mbtype & MBTYPE_REMOTE)) {
	/* remote mailbox */
	struct backend *s = NULL;
...
	s = proxy_findserver(newserver, &imap_protocol,
			     proxy_userid, &backend_cached,
			     &backend_current, &backend_inbox, imapd_in);
	if (!s) r = IMAP_SERVER_UNAVAILABLE;

	if (!r) {
	    int is_active = 1;
	    s->context = (void*) &is_active;
	    if (imapd_mailbox) {
		prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s"
			    " {" SIZE_T_FMT "+}\r\n%s ",
			    tag, strlen(name), name,
			    strlen(imapd_mailbox->name), imapd_mailbox->name);
	    } else {
		prot_printf(s->out, "%s Localappend {" SIZE_T_FMT "+}\r\n%s"
			    " {" SIZE_T_FMT "+}\r\n%s ",
			    tag, strlen(name), name, 0, "");
	    }
	    if (!(r = pipe_command(s, 16384))) {
		pipe_including_tag(s, tag, 0);
	    }
	    s->context = NULL;
	} else {
	    eatline(imapd_in, prot_getc(imapd_in));
	}

	if (r) {
	    prot_printf(imapd_out, "%s NO %s\r\n", tag,
			prot_error(imapd_in) ? prot_error(imapd_in) :
			error_message(r));
	}

	return;
     }

Obviously, it would need a little work to merge this in, but I think  
it's pretty trivial.

:wes


More information about the Info-cyrus mailing list