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

6 messages from 2006-10-12 to 2006-10-18. Participants: Markus Amsler, Junio C Hamano, Mike McCormack.
Thread: https://gitlist.dev/t/5910

## Markus Amsler, 2006-10-12 22:19

Subject: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <452EBF77.7040301@oribi.org>
URL: https://gitlist.dev/e/452EBF77.7040301%40oribi.org

```
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(-)

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, 2006-10-18 06:04

Subject: Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <7vlknegnwk.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vlknegnwk.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <452EBF77.7040301@oribi.org>

```
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(-)

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, 2006-10-18 08:53

Subject: Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <4535EB99.3090006@oribi.org>
URL: https://gitlist.dev/e/4535EB99.3090006%40oribi.org
In-Reply-To: <7vlknegnwk.fsf@assigned-by-dhcp.cox.net>

```
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?
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
> 
> 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;
> 
> 

```

## Junio C Hamano, 2006-10-18 10:28

Subject: Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <7vejt53olg.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vejt53olg.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <45367A5F.7060507@codeweavers.com>

```
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.

```

## Markus Amsler, 2006-10-18 11:54

Subject: Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <453615E6.4090008@oribi.org>
URL: https://gitlist.dev/e/453615E6.4090008%40oribi.org
In-Reply-To: <7vejt53olg.fsf@assigned-by-dhcp.cox.net>

```
Junio C Hamano wrote:
> 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

```

## Mike McCormack, 2006-10-18 19:02

Subject: Re: [PATCH] git-imap-send: Strip smtp From_ header from imap message.
Message-ID: <45367A5F.7060507@codeweavers.com>
URL: https://gitlist.dev/e/45367A5F.7060507%40codeweavers.com
In-Reply-To: <7vlknegnwk.fsf@assigned-by-dhcp.cox.net>

```

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

```
