[dovecot-cvs] dovecot/src/deliver deliver.c, 1.20.2.11, 1.20.2.12 mail-send.c, 1.1.2.1, 1.1.2.2

tss at dovecot.org tss at dovecot.org
Sun Oct 8 21:09:49 UTC 2006


Update of /var/lib/cvs/dovecot/src/deliver
In directory talvi:/tmp/cvs-serv24598

Modified Files:
      Tag: branch_1_0
	deliver.c mail-send.c 
Log Message:
Log all mail saves and save failures.



Index: deliver.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/deliver.c,v
retrieving revision 1.20.2.11
retrieving revision 1.20.2.12
diff -u -d -r1.20.2.11 -r1.20.2.12
--- deliver.c	8 Oct 2006 19:24:36 -0000	1.20.2.11
+++ deliver.c	8 Oct 2006 20:09:47 -0000	1.20.2.12
@@ -11,6 +11,7 @@
 #include "istream-seekable.h"
 #include "module-dir.h"
 #include "str.h"
+#include "str-sanitize.h"
 #include "var-expand.h"
 #include "message-address.h"
 #include "dict-client.h"
@@ -104,6 +105,7 @@
 	struct mailbox *box;
 	struct mailbox_transaction_context *t;
 	struct mail_keywords *kw;
+	const char *msgid;
 	int ret = 0;
 
 	box = mailbox_open_or_create_synced(storage, mailbox);
@@ -123,6 +125,12 @@
 	else
 		ret = mailbox_transaction_commit(&t, 0);
 
+	msgid = mail_get_first_header(mail, "Message-ID");
+	i_info(ret < 0 ? "msgid=%s: save failed to %s" :
+	       "msgid=%s: saved mail to %s",
+	       msgid == NULL ? "" : str_sanitize(msgid, 80),
+	       str_sanitize(mailbox_get_name(box), 80));
+
 	mailbox_close(&box);
 	return ret;
 }

Index: mail-send.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/deliver/mail-send.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- mail-send.c	11 Jun 2006 11:10:55 -0000	1.1.2.1
+++ mail-send.c	8 Oct 2006 20:09:47 -0000	1.1.2.2
@@ -4,6 +4,7 @@
 #include "ioloop.h"
 #include "hostpid.h"
 #include "istream.h"
+#include "str-sanitize.h"
 #include "message-date.h"
 #include "message-size.h"
 #include "duplicate.h"
@@ -31,13 +32,16 @@
     struct message_size hdr_size;
     const char *return_addr, *str;
     const unsigned char *data;
-    const char *msgid, *boundary;
+    const char *msgid, *orig_msgid, *boundary;
     size_t size;
     int ret;
 
+    orig_msgid = mail_get_first_header(mail, "Message-ID");
     return_addr = deliver_get_return_address(mail);
     if (return_addr == NULL) {
-	    i_info("Return-Path missing, rejection reason: %s", reason);
+	    i_info("msgid=%s: Return-Path missing, rejection reason: %s",
+		   orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
+		   str_sanitize(reason, 512));
 	    return -1;
     }
 
@@ -80,9 +84,8 @@
 	fprintf(f, "Original-Recipient: rfc822; %s\r\n", str);
     fprintf(f, "Final-Recipient: rfc822; %s\r\n", recipient);
 
-    str = mail_get_first_header(mail, "Message-ID");
-    if (str != NULL)
-	fprintf(f, "Original-Message-ID: %s\r\n", str);
+    if (orig_msgid != NULL)
+	fprintf(f, "Original-Message-ID: %s\r\n", orig_msgid);
     fprintf(f, "Disposition: "
 	    "automatic-action/MDN-sent-automatically; deleted\r\n");
     fprintf(f, "\r\n");



More information about the dovecot-cvs mailing list