You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by so...@apache.org on 2006/01/30 23:00:06 UTC
svn commit: r373604 - /httpd/mod_smtpd/trunk/src/smtp_protocol.c
Author: soc-rian
Date: Mon Jan 30 14:00:04 2006
New Revision: 373604
URL: http://svn.apache.org/viewcvs?rev=373604&view=rev
Log:
RFC compliance:
- Don't allow a transaction without HELO/EHLO first.
- If we responded to a connection with a 554, then don't allow
another other commands, respond with a 503.
Modified:
httpd/mod_smtpd/trunk/src/smtp_protocol.c
Modified: httpd/mod_smtpd/trunk/src/smtp_protocol.c
URL: http://svn.apache.org/viewcvs/httpd/mod_smtpd/trunk/src/smtp_protocol.c?rev=373604&r1=373603&r2=373604&view=diff
==============================================================================
--- httpd/mod_smtpd/trunk/src/smtp_protocol.c (original)
+++ httpd/mod_smtpd/trunk/src/smtp_protocol.c Mon Jan 30 14:00:04 2006
@@ -227,6 +227,12 @@
smtpd_return_data *out_data = NULL;
smtpd_bool disconnect = SMTPD_FALSE;
+ if (scr->should_disconnect == SMTPD_TRUE) {
+ smtpd_respond_oneline(scr, 503, "Please disconnect using the "
+ " QUIT command");
+ return disconnect;
+ }
+
if (buffer == NULL) {
goto syntax_error;
}
@@ -321,12 +327,26 @@
smtpd_return_data *out_data = NULL;
smtpd_bool disconnect = SMTPD_FALSE;
+ if (scr->should_disconnect == SMTPD_TRUE) {
+ smtpd_respond_oneline(scr, 503, "Please disconnect using the "
+ " QUIT command");
+ return disconnect;
+ }
+
+ /* need helo before we can start a transaction */
+ if (scr->protocol_type == SMTPD_PROTOCOL_UNKNOWN) {
+ smtpd_respond_oneline(scr, 503, "Error: Need EHLO/HELO "
+ "before a transaction");
+ return disconnect;
+ }
+
/* already got mail */
if (scr->envelope->trans_state == SMTPD_STATE_GOT_MAIL) {
smtpd_respond_oneline(scr, 503, "Error: Nested MAIL command");
return disconnect;
}
+
if (buffer == NULL) {
goto syntax_error;
}
@@ -410,6 +430,12 @@
smtpd_return_data *out_data = NULL;
smtpd_bool disconnect = SMTPD_FALSE;
+ if (scr->should_disconnect == SMTPD_TRUE) {
+ smtpd_respond_oneline(scr, 503, "Please disconnect using the "
+ " QUIT command");
+ return disconnect;
+ }
+
/* need mail first */
if ((scr->envelope->trans_state != SMTPD_STATE_GOT_MAIL) &&
(scr->envelope->trans_state != SMTPD_STATE_GOT_RCPT)) {
@@ -673,6 +699,12 @@
smtpd_bool disconnect = SMTPD_FALSE;
smtpd_return_data *out_data = NULL;
+ if (scr->should_disconnect == SMTPD_TRUE) {
+ smtpd_respond_oneline(scr, 503, "Please disconnect using the "
+ " QUIT command");
+ return disconnect;
+ }
+
/* qpsmtpd does this after calling smtpd_run_data()
but that doesn't make sense with the rest of this code
so we do this check here */
@@ -745,6 +777,12 @@
int error;
smtpd_return_data *out_data = NULL;
smtpd_bool disconnect = SMTPD_FALSE;
+
+ if (scr->should_disconnect == SMTPD_TRUE) {
+ smtpd_respond_oneline(scr, 503, "Please disconnect using the "
+ " QUIT command");
+ return disconnect;
+ }
if (buffer == NULL) {
goto syntax_error;