From: Eric Allman Date: Tue, 6 Jul 1982 04:19:55 +0000 (-0800) Subject: count Mail-From: lines to avoid loops (simulates hop counts) X-Git-Tag: BSD-4_1c_2-Snapshot-Development~3017 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/00ffc009df641e3a67ffc412f6a2e01a933314c8 count Mail-From: lines to avoid loops (simulates hop counts) SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.41 SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.20 --- diff --git a/usr/src/usr.sbin/sendmail/src/collect.c b/usr/src/usr.sbin/sendmail/src/collect.c index de3b2844ba..0444669334 100644 --- a/usr/src/usr.sbin/sendmail/src/collect.c +++ b/usr/src/usr.sbin/sendmail/src/collect.c @@ -1,7 +1,7 @@ # include # include "sendmail.h" -SCCSID(@(#)collect.c 3.40 %G%); +SCCSID(@(#)collect.c 3.41 %G%); /* ** COLLECT -- read & parse message header & make temp file. @@ -273,6 +273,10 @@ maketemp(from) .... so we will ignore the problem for the time being */ } + /* check for hop count overflow */ + if (HopCount > MAXHOP) + syserr("Too many hops (%d max); probably forwarding loop", MAXHOP); + if ((TempFile = fopen(CurEnv->e_df, "r")) == NULL) syserr("Cannot reopen %s", CurEnv->e_df); diff --git a/usr/src/usr.sbin/sendmail/src/headers.c b/usr/src/usr.sbin/sendmail/src/headers.c index 58d3462d97..3fbe633c4d 100644 --- a/usr/src/usr.sbin/sendmail/src/headers.c +++ b/usr/src/usr.sbin/sendmail/src/headers.c @@ -1,7 +1,7 @@ # include # include "sendmail.h" -SCCSID(@(#)headers.c 3.19 %G%); +SCCSID(@(#)headers.c 3.20 %G%); /* ** CHOMPHEADER -- process and save a header line. @@ -100,6 +100,10 @@ chompheader(line, def) if (QueueRun && h != NULL && bitset(H_FORCE, h->h_flags)) return (h->h_flags); + /* count Mail-From: lines to avoid loops (simulate hop counts) */ + if (strcmp(fname, "mail-from") == 0) + HopCount++; + /* create/fill in a new node */ if (h == NULL || bitset(H_FORCE, h->h_flags)) {