Преглед на файлове

Disable empty MAIL FROM check after DATA (#99)

* Disable empty MAIL FROM check after DATA

According to rfc2821, all undeliverable mail notification messages use a
null return path and will otherwise be rejected by the server.

* Fix tests so they work without the MAIL FROM check
Snow Leopard преди 7 години
родител
ревизия
ffb7190558
променени са 2 файла, в които са добавени 3 реда и са изтрити 6 реда
  1. 0 4
      server.go
  2. 3 2
      tests/guerrilla_test.go

+ 0 - 4
server.go

@@ -453,10 +453,6 @@ func (server *server) handleClient(client *client) {
 				client.kill()
 
 			case strings.Index(cmd, "DATA") == 0:
-				if client.MailFrom.IsEmpty() {
-					client.sendResponse(response.Canned.FailNoSenderDataCmd)
-					break
-				}
 				if len(client.RcptTo) == 0 {
 					client.sendResponse(response.Canned.FailNoRecipientsDataCmd)
 					break

+ 3 - 2
tests/guerrilla_test.go

@@ -33,8 +33,9 @@ import (
 	"net"
 	"strings"
 
-	"github.com/flashmob/go-guerrilla/tests/testcert"
 	"os"
+
+	"github.com/flashmob/go-guerrilla/tests/testcert"
 )
 
 type TestConfig struct {
@@ -1139,7 +1140,7 @@ func TestFuzz86f25b86b09897aed8f6c2aa5b5ee1557358a6de(t *testing.T) {
 				conn,
 				bufin,
 				"DATA\r\n")
-			expected := "503 5.5.1 Error: No sender"
+			expected := "503 5.5.1 Error: No recipients"
 			if strings.Index(response, expected) != 0 {
 				t.Error("Server did not respond with", expected, ", it said:"+response, err)
 			}