SCCS-vsn: usr.sbin/sendmail/src/srvrsmtp.c 8.30
-static char sccsid[] = "@(#)srvrsmtp.c 8.29 (Berkeley) %G% (with SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.30 (Berkeley) %G% (with SMTP)";
-static char sccsid[] = "@(#)srvrsmtp.c 8.29 (Berkeley) %G% (without SMTP)";
+static char sccsid[] = "@(#)srvrsmtp.c 8.30 (Berkeley) %G% (without SMTP)";
#endif
#endif /* not lint */
#endif
#endif /* not lint */
+#define MAXBADCOMMANDS 25 /* maximum number of bad commands */
+
smtp(e)
register ENVELOPE *e;
{
smtp(e)
register ENVELOPE *e;
{
case CMDQUIT: /* quit -- leave mail */
message("221 %s closing connection", MyHostName);
case CMDQUIT: /* quit -- leave mail */
message("221 %s closing connection", MyHostName);
/* avoid future 050 messages */
disconnect(1, e);
/* avoid future 050 messages */
disconnect(1, e);
/* FALL THROUGH */
case CMDERROR: /* unknown command */
/* FALL THROUGH */
case CMDERROR: /* unknown command */
+ if (++badcommands > MAXBADCOMMANDS)
+ {
+ message("421 %s Too many bad commands; closing connection",
+ MyHostName);
+ goto doquit;
+ }
+
message("500 Command unrecognized");
break;
message("500 Command unrecognized");
break;