Article View: pl.comp.mail.mta
Article #221Re: ListProc
From: Piotr Kucharski
Date: Thu, 05 Feb 1998 18:58
Date: Thu, 05 Feb 1998 18:58
120 lines
5286 bytes
5286 bytes
Pawel Krawczyk <kravietz@ceti.com.pl> wrote:
> A musi być na końcu linijki? U mnie jest przedostatnie, bo
Nie musi.
> na końcu jest -e 2>&1 >/dev/null, zgodnie z radą na problem
Eee, nigdy sie nie zdarzylo.
> nadmiarowy fclose()'.
pojecia nie mam o co im chodzi.
> To ja chętnie. Co prawda nagłówków mi nie ucina, tylko wprost przeciwnie,
> ale może się przyda.
Znaczy, jak wprost przeciwnie? :o
a tutaj patch:
-----------------------8><-------------------------------------
diff -ruB src.org/list.c src/list.c
--- src.org/list.c Fri Jun 27 22:32:39 1997
+++ src/list.c Wed Dec 3 02:23:21 1997
@@ -1171,7 +1171,18 @@
long int lines_to_skip = 0; /* skip lines of incoming message */
long int sig_mask;
MATCHED_PREC_HEADER *out_header = matched_prec_header;
+ MATCHED_PREC_HEADER *last_header = NULL;
PRECIOUS_HEADER *pheader;
+/*
+ Content-Type sometimes is too long because it's in two lines,
+ so I've added quick hack to treat lines begining with whitespace
+ as valid headers. To clean headers from Received: long lines, which
+ are obsolete anyway, pk_match_header is set to 0 thus allowing
+ checks to leave it.
+ Anyway, it was lame, that ListProc didn't know about it, wasn't it?
+ Piotr 'Beeth' Kucharski 97.11.30
+*/
+ int pk_match_header = 1;
int request_found, i;
/* gets set if anyone wants digests */
@@ -1247,16 +1260,19 @@
extract_origin (reply_to),
upcase (reply_to);
- else if (re_strcmp (PRECEDENCE, line, match) > 0)
+ else if (re_strcmp (PRECEDENCE, line, match) > 0) {
strcpy (precedence, line + strlen (match)), /* Remove "Precedence: " */
precedence [strlen (precedence) - 1] = EOS, /* \n -> \0 */
upcase (precedence);
+ pk_match_header = 0;
+ }
else if (re_strcmp (RECEIVED, line, match) > 0) { /* Check for fake mail */
strcpy (received, line + strlen (match));
received [strlen (received) - 1] = EOS;
sscanf (received, "%s %s", error, received); /* Get host after "from" */
upcase (received); /* Relay host */
+ pk_match_header = 0;
if (fake_mail && (at = strchr (sender_copy + 1, '@')))
if (re_strcmp (at + 1, received, NULL) > 0)
fake_mail = FALSE;
@@ -1272,9 +1288,11 @@
message_id [strlen (message_id) - 1] = EOS; /* \n -> \0 */
else { /* Check if precious header line */
+ if ( line[0] != '\0' ) { /* no need to process empty string -- Beeth */
pheader = sys.lists[listid].header;
while (pheader) {
- if (!strncmp (line, pheader->line, strlen (pheader->line))) {
+ if (!strncasecmp (line, pheader->line, strlen (pheader->line)) ||
+ (isspace(line[0]) && pk_match_header) ) {
if (! (out_header =
(MATCHED_PREC_HEADER *) malloc (sizeof (MATCHED_PREC_HEADER))))
report_progress (report, "\nprocess_message(): malloc() failed",
@@ -1286,11 +1304,18 @@
TRUE),
gexit (11);
strcpy (out_header->line, line);
- out_header->next = matched_prec_header;
- matched_prec_header = out_header;
+ out_header->next = NULL;
+ if (!last_header) /* I had to rewrite */
+ matched_prec_header = out_header; /* following lines */
+ else /* to make listproc */
+ last_header->next = out_header; /* NOT to reverse it */
+ last_header = out_header; /* in output -- Beeth */
+ pk_match_header = 1; /* Allow whitespace hack work -- Beeth */
+ break; /* if it matches pheader, why find another match? -- Beeth */
}
pheader = pheader->next;
}
+ }
}
RESET (line);
diff -ruB src.org/misc.c src/misc.c
--- src.org/misc.c Fri Jun 27 22:32:41 1997
+++ src/misc.c Wed Dec 3 02:35:59 1997
@@ -586,7 +586,9 @@
sys->lists[id].header = NULL;
while (!feof (config) && strcmp (sys->arg, "}")) {
RESET (sys->arg);
- fscanf (config, "%s\n", sys->arg);
+ /* fscanf (config, "%s\n", sys->arg); */
+ fgets (sys->arg, MAX_LINE, config); /* That allows whitespaces in */
+ sys->arg[strlen(sys->arg)-1]='\0'; /* headers in config -- Beeth */
if (sys->arg[0] == '#') {
fgets (sys->arg, MAX_LINE - 2, config);
continue;
-----------------------8><-------------------------------------
Mam nadzieje, ze patch zrozumialy :) jak nie, to wyjasnie, co robi.
Piotr
--
<A HREF="http://akson.sgh.waw.pl/~chopin/"> Piotr 'Beeth' Kucharski </A>
Peace cannot be kept by force. It can only be achieved by understanding.
Technical Details
Message-ID:
<6bd24o$8je$1@dukat.sgh.waw.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!sgh.waw.pl!not-for-mailReferences:
<6au2ch$man$3@sunsite.icm.edu.pl> <6b6j0s$ll3$2@dukat.sgh.waw.pl> <6bagai$gg$1@sunsite.icm.edu.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!pingwin.icm.edu.pl!news.icm.edu.pl!sgh.waw.pl!not-for-mail From: Piotr Kucharski <chopin@sgh.waw.pl> Newsgroups: pl.comp.mail.mta Subject: Re: ListProc Date: 5 Feb 1998 18:58:32 GMT Organization: Szkola Glowna Handlowa w Warszawie Lines: 122 Message-ID: <6bd24o$8je$1@dukat.sgh.waw.pl> References: <6au2ch$man$3@sunsite.icm.edu.pl> <6b6j0s$ll3$2@dukat.sgh.waw.pl> <6bagai$gg$1@sunsite.icm.edu.pl> NNTP-Posting-Host: jantar-eth.sgh.waw.pl Mime-Version: 1.0 X-Newsreader: TIN [UNIX 1.3 unoff BETA 970327; sun4m SunOS 5.5] Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit