[bktools patch] mailsplit: handle tabs in headers

From: Benjamin LaHaise
Date: Fri Apr 01 2005 - 15:40:10 EST


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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/