Skip to contentSkip to conversation

git-imap-send: Strip smtp From_ header from imap message.

PATCH In review Markus Amsler 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-imap-send: Strip smtp From_ header from imap message.

Cyrus imap refuses messages with a 'From ' Header.

---
  imap-send.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
imap-send.c +8 -0
index 362e474..16804ab 100644
@@ -1226,6 +1226,14 @@ split_msg( msg_data_t *all_msgs, msg_dat
 	if (msg->len < 5 || strncmp( data, "From ", 5 ))
 		return 0;
 
+	p = strchr( data, '\n' );
+	if (p) {
+		p = &p[1];
+		msg->len -= p-data;
+		*ofs += p-data;
+		data = p;
+	}
+
 	p = strstr( data, "\nFrom " );
 	if (p)
 		msg->len = &p[1] - data;
#1 lore raw
Quoted 3 lines · Markus Amsler

Cyrus imap refuses messages with a 'From ' Header.

Do you know if this change does not upset other implementations of imap servers?

Mike, are you Ok with this change?

---
  imap-send.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
imap-send.c +8 -0
index 362e474..16804ab 100644
@@ -1226,6 +1226,14 @@ split_msg( msg_data_t *all_msgs, msg_dat
 	if (msg->len < 5 || strncmp( data, "From ", 5 ))
 		return 0;
 
+	p = strchr( data, '\n' );
+	if (p) {
+		p = &p[1];
+		msg->len -= p-data;
+		*ofs += p-data;
+		data = p;
+	}
+
 	p = strstr( data, "\nFrom " );
 	if (p)
 		msg->len = &p[1] - data;
#2 lore raw
Quoted 8 lines · Junio C Hamano
Quoted 3 lines · Markus Amsler

Cyrus imap refuses messages with a 'From ' Header.

Do you know if this change does not upset other implementations of imap servers?

I only tested it with cyrus 2.1.18 on debian. I did some research: The From_ header field was introduced in rfc976 which only affects UUCP(Unix to Unix CoPy). I assume it's an invalid header field in SMTP/IMAP, and most implementation ignores it. I'm no mail header guru, so I could be wrong

Markus

Quoted 28 lines

Mike, are you Ok with this change?

---
  imap-send.c |    8 ++++++++
  1 files changed, 8 insertions(+), 0 deletions(-)
imap-send.c +8 -0
index 362e474..16804ab 100644
@@ -1226,6 +1226,14 @@ split_msg( msg_data_t *all_msgs, msg_dat
 	if (msg->len < 5 || strncmp( data, "From ", 5 ))
 		return 0;
 
+	p = strchr( data, '\n' );
+	if (p) {
+		p = &p[1];
+		msg->len -= p-data;
+		*ofs += p-data;
+		data = p;
+	}
+
 	p = strstr( data, "\nFrom " );
 	if (p)
 		msg->len = &p[1] - data;
#3 lore raw
In reply to Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 3 lines · Markus Amsler

Cyrus imap refuses messages with a 'From ' Header.

Do you know if this change does not upset other implementations of imap servers?

Mike, are you Ok with this change?

Works for me with Courier IMAP. I'm no expert on mail headers either, so no objections from me.

Mike

#4 lore raw
Quoted 10 lines · Mike McCormack
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Markus Amsler

Cyrus imap refuses messages with a 'From ' Header.

Do you know if this change does not upset other implementations of imap servers?

Quoted 6 lines
Quoted 1 line

Mike, are you Ok with this change?

Works for me with Courier IMAP. I'm no expert on mail headers either, so no objections from me.

Mike

Thanks; then will apply.

By the way, Markus, did you send the patch with imap-send? It had a funny whitespace corruptions.

#5 lore raw
Quoted 15 lines · Junio C Hamano
Quoted 13 lines · Mike McCormack
Quoted 9 lines · Junio C Hamano
Quoted 3 lines · Markus Amsler

Cyrus imap refuses messages with a 'From ' Header.

Do you know if this change does not upset other implementations of imap servers?

Mike, are you Ok with this change?

Works for me with Courier IMAP. I'm no expert on mail headers either, so no objections from me.

Quoted 6 lines
Quoted 1 line

Mike

Thanks; then will apply.

By the way, Markus, did you send the patch with imap-send? It had a funny whitespace corruptions.

No, I was too lazy to set up an imap config for one patch. So I used git diff an copy pasted it into Thunderbird. Sorry.

Markus