[dovecot-cvs] dovecot/src/deliver deliver.c,1.56,1.57
tss at dovecot.org
tss at dovecot.org
Sat Mar 17 14:07:41 EET 2007
Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv30325
Modified Files:
deliver.c
Log Message:
Ignore -m "" parameter. Added -n option to not autocreate the mailbox. If
saving to given mailbox fails, fallback to saving to INBOX.
Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- deliver.c 15 Mar 2007 15:53:00 -0000 1.56
+++ deliver.c 17 Mar 2007 12:07:39 -0000 1.57
@@ -49,6 +49,7 @@
/* FIXME: these two should be in some context struct instead of as globals.. */
static const char *default_mailbox_name = NULL;
static bool tried_default_save = FALSE;
+static bool no_mailbox_autocreate = FALSE;
static struct module *modules;
static struct ioloop *ioloop;
@@ -81,7 +82,7 @@
box = mailbox_open(storage, name, NULL, MAILBOX_OPEN_FAST |
MAILBOX_OPEN_KEEP_RECENT);
- if (box != NULL)
+ if (box != NULL || no_mailbox_autocreate)
return box;
(void)mail_storage_get_last_error(storage, &syntax, &temp);
@@ -450,7 +451,7 @@
{
printf(
"Usage: deliver [-c <config file>] [-d <destination user>] [-m <mailbox>]\n"
-" [-f <envelope sender>]\n");
+" [-n] [-f <envelope sender>]\n");
}
void deliver_env_clean(void)
@@ -530,7 +531,13 @@
i_fatal_status(EX_USAGE,
"Missing mailbox argument");
}
- mailbox = argv[i];
+ /* Ignore -m "". This allows doing -m ${extension}
+ in Postfix to handle user+mailbox */
+ if (*argv[i] != '\0')
+ mailbox = argv[i];
+ } else if (strcmp(argv[i], "-n") == 0) {
+ /* destination mailbox */
+ no_mailbox_autocreate = TRUE;
} else if (strcmp(argv[i], "-f") == 0) {
/* envelope sender address */
i++;
@@ -685,6 +692,12 @@
/* plugins didn't handle this. save into the default mailbox. */
i_stream_seek(input, 0);
ret = deliver_save(storage, mailbox, mail, 0, NULL);
+ if (ret < 0 && strcasecmp(mailbox, "INBOX") != 0) {
+ /* still didn't work. try once more to save it
+ to INBOX. */
+ i_stream_seek(input, 0);
+ ret = deliver_save(storage, "INBOX", mail, 0, NULL);
+ }
}
if (ret < 0) {
More information about the dovecot-cvs
mailing list