diff options
author | Omar Polo <op@cvs.openbsd.org> | 2023-06-23 18:32:29 +0000 |
---|---|---|
committer | Omar Polo <op@cvs.openbsd.org> | 2023-06-23 18:32:29 +0000 |
commit | c40b58d41e21ee199aa8ec38bb2e8df9c137db39 (patch) | |
tree | 21a51d70c2e93bb01f141e572aa15142cee90ab3 /usr.sbin/smtpd | |
parent | d0184427a282be2779ba44284ee5bac77318eb73 (diff) |
smtpd: allow arguments on NOOP
per RFC3521 § 4.1.1.9 the NOOP command allows optionally one argument
that SHOULD be ignored. For semplicity, relax it to allow anything after it.
Original diff by Sebastian J. Bronner, GitHub PR 1150, tweaked by me to
add smtp_check_noop().
Gilles agrees, ok millert@
Diffstat (limited to 'usr.sbin/smtpd')
-rw-r--r-- | usr.sbin/smtpd/smtp_session.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/smtpd/smtp_session.c b/usr.sbin/smtpd/smtp_session.c index 1686f03e96d..470b86b48d5 100644 --- a/usr.sbin/smtpd/smtp_session.c +++ b/usr.sbin/smtpd/smtp_session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtp_session.c,v 1.434 2023/05/31 16:51:46 op Exp $ */ +/* $OpenBSD: smtp_session.c,v 1.435 2023/06/23 18:32:28 op Exp $ */ /* * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org> @@ -212,6 +212,7 @@ static int smtp_check_starttls(struct smtp_session *, const char *); static int smtp_check_mail_from(struct smtp_session *, const char *); static int smtp_check_rcpt_to(struct smtp_session *, const char *); static int smtp_check_data(struct smtp_session *, const char *); +static int smtp_check_noop(struct smtp_session *, const char *); static int smtp_check_noparam(struct smtp_session *, const char *); static void smtp_filter_phase(enum filter_phase, struct smtp_session *, const char *); @@ -276,7 +277,7 @@ static struct { { CMD_DATA, FILTER_DATA, "DATA", smtp_check_data, smtp_proceed_data }, { CMD_RSET, FILTER_RSET, "RSET", smtp_check_rset, smtp_proceed_rset }, { CMD_QUIT, FILTER_QUIT, "QUIT", smtp_check_noparam, smtp_proceed_quit }, - { CMD_NOOP, FILTER_NOOP, "NOOP", smtp_check_noparam, smtp_proceed_noop }, + { CMD_NOOP, FILTER_NOOP, "NOOP", smtp_check_noop, smtp_proceed_noop }, { CMD_HELP, FILTER_HELP, "HELP", smtp_check_noparam, smtp_proceed_help }, { CMD_WIZ, FILTER_WIZ, "WIZ", smtp_check_noparam, smtp_proceed_wiz }, { CMD_COMMIT, FILTER_COMMIT, ".", smtp_check_noparam, smtp_proceed_commit }, @@ -1343,8 +1344,8 @@ smtp_command(struct smtp_session *s, char *line) break; case CMD_NOOP: - if (!smtp_check_noparam(s, args)) - break; + if (!smtp_check_noop(s, args)) + break; smtp_filter_phase(FILTER_NOOP, s, NULL); break; @@ -1631,6 +1632,12 @@ smtp_check_data(struct smtp_session *s, const char *args) } static int +smtp_check_noop(struct smtp_session *s, const char *args) +{ + return 1; +} + +static int smtp_check_noparam(struct smtp_session *s, const char *args) { if (args != NULL) { |