count Mail-From: lines to avoid loops (simulates hop counts)
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 6 Jul 1982 04:19:55 +0000 (20:19 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Tue, 6 Jul 1982 04:19:55 +0000 (20:19 -0800)
SCCS-vsn: usr.sbin/sendmail/src/collect.c 3.41
SCCS-vsn: usr.sbin/sendmail/src/headers.c 3.20

usr/src/usr.sbin/sendmail/src/collect.c
usr/src/usr.sbin/sendmail/src/headers.c

index de3b284..0444669 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)collect.c   3.40            %G%);
+SCCSID(@(#)collect.c   3.41            %G%);
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
 
 /*
 **  COLLECT -- read & parse message header & make temp file.
@@ -273,6 +273,10 @@ maketemp(from)
                .... so we will ignore the problem for the time being */
        }
 
                .... 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);
 
        if ((TempFile = fopen(CurEnv->e_df, "r")) == NULL)
                syserr("Cannot reopen %s", CurEnv->e_df);
 
index 58d3462..3fbe633 100644 (file)
@@ -1,7 +1,7 @@
 # include <errno.h>
 # include "sendmail.h"
 
 # include <errno.h>
 # include "sendmail.h"
 
-SCCSID(@(#)headers.c   3.19            %G%);
+SCCSID(@(#)headers.c   3.20            %G%);
 
 /*
 **  CHOMPHEADER -- process and save a header line.
 
 /*
 **  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);
 
        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))
        {
        /* create/fill in a new node */
        if (h == NULL || bitset(H_FORCE, h->h_flags))
        {