masqmail-0.2

changeset 127:05fe7500149d

refactored SMTP_HELO and SMTP_EHLO cases
author meillo@marmaro.de
date Tue, 06 Jul 2010 08:18:10 +0200
parents 8a2b38c567c1
children f9d5469cb648
files src/smtp_in.c
diffstat 1 files changed, 16 insertions(+), 17 deletions(-) [+]
line diff
     1.1 --- a/src/smtp_in.c	Thu Jul 01 14:31:16 2010 +0200
     1.2 +++ b/src/smtp_in.c	Tue Jul 06 08:18:10 2010 +0200
     1.3 @@ -176,26 +176,25 @@
     1.4  	while ((len = read_sockline(in, buffer, BUF_LEN, 5 * 60, READSOCKL_CHUG)) >= 0) {
     1.5  		cmd_id = get_id(buffer);
     1.6  
     1.7 +		if (conf.defer_all) {  /* I need this to debug delivery failures */
     1.8 +			smtp_printf(out, "421 %s service temporarily unavailable.\r\n", conf.host_name);
     1.9 +			break;
    1.10 +		}
    1.11 +
    1.12  		switch (cmd_id) {
    1.13 +		case SMTP_HELO:
    1.14 +			psc->prot = PROT_SMTP;
    1.15 +			psc->helo_seen = TRUE;
    1.16 +			smtp_printf(out, "250 %s pretty old mailer, huh?\r\n", conf.host_name);
    1.17 +			break;
    1.18 +
    1.19  		case SMTP_EHLO:
    1.20  			psc->prot = PROT_ESMTP;
    1.21 -			/* fall through */
    1.22 -		case SMTP_HELO:
    1.23  			psc->helo_seen = TRUE;
    1.24 -
    1.25 -			if (conf.defer_all) {  /* I need this to debug delivery failures */
    1.26 -				smtp_printf(out, "421 %s service temporarily unavailable.\r\n", conf.host_name);
    1.27 -				break;
    1.28 -			}
    1.29 -
    1.30 -			if (psc->prot == PROT_ESMTP) {
    1.31 -				smtp_printf(out, "250-%s Nice to meet you with ESMTP\r\n", conf.host_name);
    1.32 -				smtp_printf(out, "250-SIZE %d\r\n", conf.max_msg_size);
    1.33 -				smtp_printf(out, "250-PIPELINING\r\n");
    1.34 -				smtp_printf(out, "250 HELP\r\n");
    1.35 -			} else {
    1.36 -				smtp_printf(out, "250 %s pretty old mailer, huh?\r\n", conf.host_name);
    1.37 -			}
    1.38 +			smtp_printf(out, "250-%s Nice to meet you with ESMTP\r\n", conf.host_name);
    1.39 +			smtp_printf(out, "250-SIZE %d\r\n", conf.max_msg_size);
    1.40 +			smtp_printf(out, "250-PIPELINING\r\n");
    1.41 +			smtp_printf(out, "250 HELP\r\n");
    1.42  			break;
    1.43  
    1.44  		case SMTP_MAIL_FROM:
    1.45 @@ -220,7 +219,7 @@
    1.46  					smtp_printf(out, "503 MAIL FROM: already given.\r\n");
    1.47  					break;
    1.48  				}
    1.49 -	
    1.50 +
    1.51  				msg = create_message();
    1.52  				msg->received_host = remote_host ? g_strdup(remote_host) : NULL;
    1.53  				msg->received_prot = psc->prot;