threads / patch / 5910

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

Subject: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

## tl;dr

6 messages between Oct 12, 2006 and Oct 18, 2006. Diffs are folded; open one to read it.

replies: 5people: 3as markdown or json

Markus Amsler· Oct 12, 2006, 22:19 UTC · lore
Cyrus imap refuses messages with a 'From ' Header.
Signed-off-by: Markus Amsler <markus.amsler@oribi.org>
---
   imap-send.c |    8 ++++++++
   1 files changed, 8 insertions(+), 0 deletions(-)
Show changes to imap-send.c +8 −0
diff --git a/imap-send.c b/imap-send.c
index 362e474..16804ab 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -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;
Junio C Hamano· Oct 18, 2006, 06:04 UTC · re: Markus Amsler · lore

Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

Markus Amsler <markus.amsler@oribi.org> writes:
> Cyrus imap refuses messages with a 'From ' Header.
>
> Signed-off-by: Markus Amsler <markus.amsler@oribi.org>

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(-)
Show changes to imap-send.c +8 −0
diff --git a/imap-send.c b/imap-send.c
index 362e474..16804ab 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -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;
Markus Amsler· Oct 18, 2006, 08:53 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

Junio C Hamano wrote:
Show 8 quoted lines
> Markus Amsler <markus.amsler@oribi.org> writes:
> 
>> Cyrus imap refuses messages with a 'From ' Header.
>>
>> Signed-off-by: Markus Amsler <markus.amsler@oribi.org>
> 
> 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
Show 28 quoted lines
> 
> Mike, are you Ok with this change?
> 
> ---
>   imap-send.c |    8 ++++++++
>   1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/imap-send.c b/imap-send.c
> index 362e474..16804ab 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -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;
> 
> 
Mike McCormack· Oct 18, 2006, 19:02 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

Junio C Hamano wrote:
Show 10 quoted lines
> Markus Amsler <markus.amsler@oribi.org> writes:
> 
>> Cyrus imap refuses messages with a 'From ' Header.
>>
>> Signed-off-by: Markus Amsler <markus.amsler@oribi.org>
> 
> 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
Junio C Hamano· Oct 18, 2006, 10:28 UTC · re: Mike McCormack · lore

Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

Mike McCormack <mike@codeweavers.com> writes:
Show 16 quoted lines
> Junio C Hamano wrote:
>> Markus Amsler <markus.amsler@oribi.org> writes:
>>
>>> Cyrus imap refuses messages with a 'From ' Header.
>>>
>>> Signed-off-by: Markus Amsler <markus.amsler@oribi.org>
>>
>> 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
Thanks; then will apply.

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

Markus Amsler· Oct 18, 2006, 11:54 UTC · re: Junio C Hamano · lore

Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.

Junio C Hamano wrote:
Show 21 quoted lines
> Mike McCormack <mike@codeweavers.com> writes:
> 
>> Junio C Hamano wrote:
>>> Markus Amsler <markus.amsler@oribi.org> writes:
>>>
>>>> Cyrus imap refuses messages with a 'From ' Header.
>>>>
>>>> Signed-off-by: Markus Amsler <markus.amsler@oribi.org>
>>> 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
> 
> 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

← back to recent threads