X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/ed0e982047b9cb760f810e056d0faf79f1d44fa1..4730f9424e0addeb902cc842508eea3f47a131ca:/src/src/smtp_in.c diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c index 00d0fb259..4ed335c02 100644 --- a/src/src/smtp_in.c +++ b/src/src/smtp_in.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/smtp_in.c,v 1.28 2005/12/14 10:00:05 ph10 Exp $ */ +/* $Cambridge: exim/src/src/smtp_in.c,v 1.33 2006/02/14 14:55:37 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2005 */ +/* Copyright (c) University of Cambridge 1995 - 2006 */ /* See the file NOTICE for conditions of use and distribution. */ /* Functions for handling an incoming SMTP call. */ @@ -626,6 +626,8 @@ for (;;) /* This function is called when logging information about an SMTP connection. It sets up appropriate source information, depending on the type of connection. +If sender_fullhost is NULL, we are at a very early stage of the connection; +just use the IP address. Argument: none Returns: a string describing the connection @@ -634,21 +636,24 @@ Returns: a string describing the connection uschar * smtp_get_connection_info(void) { +uschar *hostname = (sender_fullhost == NULL)? + sender_host_address : sender_fullhost; + if (host_checking) - return string_sprintf("SMTP connection from %s", sender_fullhost); + return string_sprintf("SMTP connection from %s", hostname); if (sender_host_unknown || sender_host_notsocket) return string_sprintf("SMTP connection from %s", sender_ident); if (is_inetd) - return string_sprintf("SMTP connection from %s (via inetd)", sender_fullhost); + return string_sprintf("SMTP connection from %s (via inetd)", hostname); if ((log_extra_selector & LX_incoming_interface) != 0 && interface_address != NULL) - return string_sprintf("SMTP connection from %s I=[%s]:%d", sender_fullhost, + return string_sprintf("SMTP connection from %s I=[%s]:%d", hostname, interface_address, interface_port); -return string_sprintf("SMTP connection from %s", sender_fullhost); +return string_sprintf("SMTP connection from %s", hostname); } @@ -806,6 +811,7 @@ message_size = -1; acl_warn_headers = NULL; queue_only_policy = FALSE; deliver_freeze = FALSE; /* Can be set by ACL */ +freeze_tell = freeze_tell_config; /* Can be set by ACL */ fake_response = OK; /* Can be set by ACL */ #ifdef WITH_CONTENT_SCAN no_mbox_unspool = FALSE; /* Can be set by ACL */ @@ -1839,19 +1845,21 @@ if (where == ACL_WHERE_RCPT || where == ACL_WHERE_DATA || where == ACL_WHERE_MIM /* If there's been a sender verification failure with a specific message, and we have not sent a response about it yet, do so now, as a preliminary line for -failures, but not defers. However, log it in both cases. */ +failures, but not defers. However, always log it for defer, and log it for fail +unless the sender_verify_fail log selector has been turned off. */ if (sender_verified_failed != NULL && !testflag(sender_verified_failed, af_sverify_told)) { setflag(sender_verified_failed, af_sverify_told); - log_write(0, LOG_MAIN|LOG_REJECT, "%s sender verify %s for <%s>%s", - host_and_ident(TRUE), - ((sender_verified_failed->special_action & 255) == DEFER)? "defer" : "fail", - sender_verified_failed->address, - (sender_verified_failed->message == NULL)? US"" : - string_sprintf(": %s", sender_verified_failed->message)); + if (rc != FAIL || (log_extra_selector & LX_sender_verify_fail) != 0) + log_write(0, LOG_MAIN|LOG_REJECT, "%s sender verify %s for <%s>%s", + host_and_ident(TRUE), + ((sender_verified_failed->special_action & 255) == DEFER)? "defer":"fail", + sender_verified_failed->address, + (sender_verified_failed->message == NULL)? US"" : + string_sprintf(": %s", sender_verified_failed->message)); if (rc == FAIL && sender_verified_failed->user_message != NULL) smtp_respond(code, FALSE, string_sprintf( @@ -2133,7 +2141,7 @@ while (done <= 0) pid_t pid; int start, end, sender_domain, recipient_domain; int ptr, size, rc; - int c; + int c, i; auth_instance *au; switch(smtp_read_command(TRUE)) @@ -2222,20 +2230,26 @@ while (done <= 0) break; } - /* Run the checking code, passing the remainder of the command - line as data. Initialize $0 empty. The authenticator may set up - other numeric variables. Afterwards, have a go at expanding the set_id - string, even if authentication failed - for bad passwords it can be useful - to log the userid. On success, require set_id to expand and exist, and - put it in authenticated_id. Save this in permanent store, as the working - store gets reset at HELO, RSET, etc. */ + /* Run the checking code, passing the remainder of the command line as + data. Initials the $auth variables as empty. Initialize $0 empty and set + it as the only set numerical variable. The authenticator may set $auth + and also set other numeric variables. The $auth variables are preferred + nowadays; the numerical variables remain for backwards compatibility. + + Afterwards, have a go at expanding the set_id string, even if + authentication failed - for bad passwords it can be useful to log the + userid. On success, require set_id to expand and exist, and put it in + authenticated_id. Save this in permanent store, as the working store gets + reset at HELO, RSET, etc. */ + for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL; expand_nmax = 0; expand_nlength[0] = 0; /* $0 contains nothing */ c = (au->info->servercode)(au, smtp_cmd_argument); if (au->set_id != NULL) set_id = expand_string(au->set_id); expand_nmax = -1; /* Reset numeric variables */ + for (i = 0; i < AUTH_VARS; i++) auth_vars[i] = NULL; /* Reset $auth */ /* The value of authenticated_id is stored in the spool file and printed in log lines. It must not contain binary zeros or newline characters. In