mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [bktools patch] mailsplit: handle tabs in headers
@ 2005-04-01 20:32 Benjamin LaHaise
  0 siblings, 0 replies; only message in thread
From: Benjamin LaHaise @ 2005-04-01 20:32 UTC (permalink / raw)
  To: Linus Torvalds, Linux Kernel

Hello Linus et al,

The patch below fixes mailsplit to cope with non-' ' space characters 
in mail headers.  Some people seem to have mail clients that use tabs 
which would result in mailsplit omitting those headers from its 
substitutions.

		-ben
-- 
"Time is what keeps everything from happening all at once." -- John Wheeler

===== mailsplit.c 1.5 vs edited =====
--- 1.5/mailsplit.c	2002-10-09 15:52:37 -04:00
+++ edited/mailsplit.c	2005-04-01 15:26:54 -05:00
@@ -37,9 +37,9 @@
 	void (*fn)(const char *);
 	char value[HDRLEN];
 } header[] = {
-	{ "From: ", parse_from },
-	{ "Subject: " },
-	{ "Date: " }
+	{ "From:", parse_from },
+	{ "Subject:" },
+	{ "Date:" }
 };
 
 enum header_type { FROM, SUBJECT, DATE, NRHEADERS };
@@ -218,6 +218,12 @@
 			int len = strlen(name);
 			if (memcmp(buffer, name, len))
 				continue;
+			if (!isspace(buffer[len])) {
+				fprintf(stderr,
+					"malformed mail: no space after header\n");
+				continue;
+			}
+			len++;
 			strncpy(header[i].value, buffer+len, HDRLEN-1);
 			if (header[i].fn)
 				header[i].fn(header[i].value);
===== Makefile 1.7 vs edited =====
--- 1.7/Makefile	2003-05-25 22:56:42 -04:00
+++ edited/Makefile	2005-04-01 15:12:42 -05:00
@@ -1,5 +1,5 @@
 CC=gcc
-CFLAGS=-Wall -O2
+CFLAGS=-Wall -g
 HOME=$(shell echo $$HOME)
 
 PROGRAMS=mailsplit diffsplit mkfile bkr

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-01 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-01 20:32 [bktools patch] mailsplit: handle tabs in headers Benjamin LaHaise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®