X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fsmtp_in.c;h=a229721cfb7891668635a3bc874d8d322b8b7bce;hb=e04bfa34ece182e956a33fdf8986813f245d76f3;hp=d804bc7d262c918d3741d577d5856619f15884f2;hpb=e34f8ca2022e340d3c0e36260a0232fab306dfcc;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index d804bc7d2..a229721cf 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -653,7 +653,7 @@ next_cmd: } receive_getc = bdat_getc; - receive_getbuf = bdat_getbuf; + receive_getbuf = bdat_getbuf; /* r~getbuf is never actually used */ receive_ungetc = bdat_ungetc; #ifndef DISABLE_DKIM dkim_collect_input = dkim_save; @@ -684,7 +684,7 @@ bdat_flush_data(void) while (chunking_data_left) { unsigned n = chunking_data_left; - (void) bdat_getbuf(&n); + if (!bdat_getbuf(&n)) break; } receive_getc = lwr_receive_getc; @@ -1947,13 +1947,13 @@ return TRUE; *************************************************/ /* This function is called whenever the SMTP session is reset from -within either of the setup functions. +within either of the setup functions; also from the daemon loop. Argument: the stacking pool storage reset point Returns: nothing */ -static void +void smtp_reset(void *reset_point) { recipients_list = NULL; @@ -1997,9 +1997,8 @@ bmi_verdicts = NULL; #endif dnslist_domain = dnslist_matched = NULL; #ifndef DISABLE_DKIM -dkim_signers = NULL; -dkim_disable_verify = FALSE; -dkim_collect_input = FALSE; +dkim_cur_signer = dkim_signers = NULL; +dkim_disable_verify = dkim_collect_input = FALSE; #endif dsn_ret = 0; dsn_envid = NULL; @@ -2008,10 +2007,7 @@ deliver_host = deliver_host_address = NULL; /* Can be set by ACL */ prdr_requested = FALSE; #endif #ifdef SUPPORT_SPF -spf_header_comment = NULL; -spf_received = NULL; -spf_result = NULL; -spf_smtp_comment = NULL; +spf_header_comment = spf_received = spf_result = spf_smtp_comment = NULL; #endif #ifdef SUPPORT_I18N message_smtputf8 = FALSE; @@ -2375,7 +2371,8 @@ smtp_exit_function_called = FALSE; /* For avoiding loop in not-quit exit */ /* If receiving by -bs from a trusted user, or testing with -bh, we allow authentication settings from -oMaa to remain in force. */ -if (!host_checking && !sender_host_notsocket) sender_host_authenticated = NULL; +if (!host_checking && !sender_host_notsocket) + sender_host_auth_pubname = sender_host_authenticated = NULL; authenticated_by = NULL; #ifdef SUPPORT_TLS @@ -3625,6 +3622,7 @@ switch(rc) { if (set_id) authenticated_id = string_copy_malloc(set_id); sender_host_authenticated = au->name; + sender_host_auth_pubname = au->public_name; authentication_failed = FALSE; authenticated_fail_id = NULL; /* Impossible to already be set? */ @@ -3724,7 +3722,7 @@ else smtp_printf("221 %s closing connection\r\n", FALSE, smtp_active_hostname); #ifdef SUPPORT_TLS -tls_close(TRUE, TRUE); +tls_close(TRUE, TLS_SHUTDOWN_NOWAIT); #endif log_write(L_smtp_connection, LOG_MAIN, "%s closed by QUIT", @@ -4556,10 +4554,10 @@ while (done <= 0) US"invalid data for AUTH"); goto COMMAND_LOOP; } - if (acl_smtp_mailauth == NULL) + if (!acl_smtp_mailauth) { ignore_msg = US"client not authenticated"; - rc = (sender_host_authenticated != NULL)? OK : FAIL; + rc = sender_host_authenticated ? OK : FAIL; } else { @@ -5356,7 +5354,7 @@ while (done <= 0) + (tls_in.active >= 0 ? pcrpted : 0) ]; - sender_host_authenticated = NULL; + sender_host_auth_pubname = sender_host_authenticated = NULL; authenticated_id = NULL; sync_cmd_limit = NON_SYNC_CMD_NON_PIPELINING; DEBUG(D_tls) debug_printf("TLS active\n"); @@ -5413,7 +5411,7 @@ while (done <= 0) smtp_printf("554 Security failure\r\n", FALSE); break; } - tls_close(TRUE, TRUE); + tls_close(TRUE, TLS_SHUTDOWN_NOWAIT); break; #endif @@ -5751,8 +5749,15 @@ authres_smtpauth(gstring * g) if (!sender_host_authenticated) return g; -g = string_append(g, 4, US";\n\tauth=pass" - " (", sender_host_authenticated, US") smtp.auth=", authenticated_id); +g = string_append(g, 2, US";\n\tauth=pass (", sender_host_auth_pubname); + +if (Ustrcmp(sender_host_auth_pubname, "tls") != 0) + g = string_append(g, 2, US") smtp.auth=", authenticated_id); +else if (authenticated_id) + g = string_append(g, 2, US") x509.auth=", authenticated_id); +else + g = string_catn(g, US") reason=x509.auth", 17); + if (authenticated_sender) g = string_append(g, 2, US" smtp.mailfrom=", authenticated_sender); return g;