# HG changeset patch # User meillo@marmaro.de # Date 1278397090 -7200 # Node ID 05fe7500149d45578676a6c6d3bb2c0162b9a320 # Parent 8a2b38c567c1dc36977c224181672eeeea72dbfd refactored SMTP_HELO and SMTP_EHLO cases diff -r 8a2b38c567c1 -r 05fe7500149d src/smtp_in.c --- 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;