[dovecot-cvs] dovecot/src/deliver deliver.c,1.63,1.64
tss at dovecot.org
tss at dovecot.org
Sun May 13 18:15:09 EEST 2007
Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv16780
Modified Files:
deliver.c
Log Message:
Added -e parameter to write rejection error to stderr and exit with
EX_NOPERM instead of sending the rejection by executing sendmail.
Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -d -r1.63 -r1.64
--- deliver.c 3 Apr 2007 08:34:27 -0000 1.63
+++ deliver.c 13 May 2007 15:15:07 -0000 1.64
@@ -460,7 +460,7 @@
{
printf(
"Usage: deliver [-c <config file>] [-d <destination user>] [-m <mailbox>]\n"
-" [-n] [-f <envelope sender>]\n");
+" [-n] [-e] [-f <envelope sender>]\n");
}
void deliver_env_clean(void)
@@ -499,6 +499,7 @@
struct mail *mail;
uid_t process_euid;
pool_t namespace_pool;
+ bool stderr_rejection = FALSE;
int i, ret;
i_set_failure_exit_callback(failure_exit_callback);
@@ -527,6 +528,8 @@
"Missing destination argument");
}
destination = argv[i];
+ } else if (strcmp(argv[i], "-e") == 0) {
+ stderr_rejection = TRUE;
} else if (strcmp(argv[i], "-c") == 0) {
/* config file path */
i++;
@@ -711,7 +714,7 @@
}
if (ret < 0) {
- const char *error;
+ const char *error, *msgid;
bool syntax, temporary_error;
int ret;
@@ -720,7 +723,16 @@
if (temporary_error)
return EX_TEMPFAIL;
+ msgid = mail_get_first_header(mail, "Message-ID");
+ i_info("msgid=%s: Rejected: %s",
+ msgid == NULL ? "" : str_sanitize(msgid, 80),
+ str_sanitize(error, 512));
+
/* we'll have to reply with permanent failure */
+ if (stderr_rejection) {
+ fprintf(stderr, "%s\n", error);
+ return EX_NOPERM;
+ }
ret = mail_send_rejection(mail, destination, error);
if (ret != 0)
return ret < 0 ? EX_TEMPFAIL : ret;
More information about the dovecot-cvs
mailing list