changeset 127:05fe7500149d

refactored SMTP_HELO and SMTP_EHLO cases
author meillo@marmaro.de
date Tue, 06 Jul 2010 08:18:10 +0200 (2010-07-06)
parents 8a2b38c567c1
children f9d5469cb648
files src/smtp_in.c
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/src/smtp_in.c	Thu Jul 01 14:31:16 2010 +0200
+++ b/src/smtp_in.c	Tue Jul 06 08:18:10 2010 +0200
@@ -176,26 +176,25 @@
 	while ((len = read_sockline(in, buffer, BUF_LEN, 5 * 60, READSOCKL_CHUG)) >= 0) {
 		cmd_id = get_id(buffer);
 
+		if (conf.defer_all) {  /* I need this to debug delivery failures */
+			smtp_printf(out, "421 %s service temporarily unavailable.\r\n", conf.host_name);
+			break;
+		}
+
 		switch (cmd_id) {
+		case SMTP_HELO:
+			psc->prot = PROT_SMTP;
+			psc->helo_seen = TRUE;
+			smtp_printf(out, "250 %s pretty old mailer, huh?\r\n", conf.host_name);
+			break;
+
 		case SMTP_EHLO:
 			psc->prot = PROT_ESMTP;
-			/* fall through */
-		case SMTP_HELO:
 			psc->helo_seen = TRUE;
-
-			if (conf.defer_all) {  /* I need this to debug delivery failures */
-				smtp_printf(out, "421 %s service temporarily unavailable.\r\n", conf.host_name);
-				break;
-			}
-
-			if (psc->prot == PROT_ESMTP) {
-				smtp_printf(out, "250-%s Nice to meet you with ESMTP\r\n", conf.host_name);
-				smtp_printf(out, "250-SIZE %d\r\n", conf.max_msg_size);
-				smtp_printf(out, "250-PIPELINING\r\n");
-				smtp_printf(out, "250 HELP\r\n");
-			} else {
-				smtp_printf(out, "250 %s pretty old mailer, huh?\r\n", conf.host_name);
-			}
+			smtp_printf(out, "250-%s Nice to meet you with ESMTP\r\n", conf.host_name);
+			smtp_printf(out, "250-SIZE %d\r\n", conf.max_msg_size);
+			smtp_printf(out, "250-PIPELINING\r\n");
+			smtp_printf(out, "250 HELP\r\n");
 			break;
 
 		case SMTP_MAIL_FROM:
@@ -220,7 +219,7 @@
 					smtp_printf(out, "503 MAIL FROM: already given.\r\n");
 					break;
 				}
-	
+
 				msg = create_message();
 				msg->received_host = remote_host ? g_strdup(remote_host) : NULL;
 				msg->received_prot = psc->prot;