{
s = string_append(s, sizep, ptrp, 5, US" H=", addr->host_used->name,
US" [", addr->host_used->address, US"]");
- if ((log_extra_selector & LX_outgoing_port) != 0)
+ if (LOGGING(outgoing_port))
s = string_append(s, sizep, ptrp, 2, US":", string_sprintf("%d",
addr->host_used->port));
return s;
static uschar *
d_tlslog(uschar * s, int * sizep, int * ptrp, address_item * addr)
{
- if ((log_extra_selector & LX_tls_cipher) != 0 && addr->cipher != NULL)
+ if (LOGGING(tls_cipher) && addr->cipher != NULL)
s = string_append(s, sizep, ptrp, 2, US" X=", addr->cipher);
- if ((log_extra_selector & LX_tls_certificate_verified) != 0 &&
- addr->cipher != NULL)
+ if (LOGGING(tls_certificate_verified) && addr->cipher != NULL)
s = string_append(s, sizep, ptrp, 2, US" CV=",
testflag(addr, af_cert_verified)
?
#endif
"yes"
: "no");
- if ((log_extra_selector & LX_tls_peerdn) != 0 && addr->peerdn != NULL)
+ if (LOGGING(tls_peerdn) && addr->peerdn != NULL)
s = string_append(s, sizep, ptrp, 3, US" DN=\"",
string_printing(addr->peerdn), US"\"");
return s;
s = reset_point = store_get(size);
-log_address = string_log_address(addr, (log_write_selector & L_all_parents) != 0, TRUE);
+log_address = string_log_address(addr, LOGGING(all_parents), TRUE);
if (msg)
s = string_append(s, &size, &ptr, 3, host_and_ident(TRUE), US" ", log_address);
else
s = string_append(s, &size, &ptr, 2, US"> ", log_address);
}
-if (log_extra_selector & LX_incoming_interface && sending_ip_address)
+if (LOGGING(incoming_interface) && sending_ip_address)
s = string_append(s, &size, &ptr, 3, US" I=[", sending_ip_address, US"]");
/* for the port: string_sprintf("%d", sending_port) */
-if ((log_extra_selector & LX_sender_on_delivery) != 0 || msg)
+if (LOGGING(sender_on_delivery) || msg)
s = string_append(s, &size, &ptr, 3, US" F=<",
#ifdef EXPERIMENTAL_INTERNATIONAL
testflag(addr, af_utf8_downcvt)
when it is not set is for a delivery to /dev/null which is optimised by not
being run at all. */
-if (used_return_path != NULL &&
- (log_extra_selector & LX_return_path_on_delivery) != 0)
+if (used_return_path != NULL && LOGGING(return_path_on_delivery))
s = string_append(s, &size, &ptr, 3, US" P=<", used_return_path, US">");
if (msg)
s = string_append(s, &size, &ptr, 2, US" T=", addr->transport->name);
-if ((log_extra_selector & LX_delivery_size) != 0)
+if (LOGGING(delivery_size))
s = string_append(s, &size, &ptr, 2, US" S=",
string_sprintf("%d", transport_count));
if (addr->auth_id)
{
s = string_append(s, &size, &ptr, 2, US":", addr->auth_id);
- if (log_extra_selector & LX_smtp_mailauth && addr->auth_sndr)
+ if (LOGGING(smtp_mailauth) && addr->auth_sndr)
s = string_append(s, &size, &ptr, 2, US":", addr->auth_sndr);
}
}
/* confirmation message (SMTP (host_used) and LMTP (driver_name)) */
-if (log_extra_selector & LX_smtp_confirmation &&
- addr->message &&
+if (LOGGING(smtp_confirmation) && addr->message &&
(addr->host_used || Ustrcmp(addr->transport->driver_name, "lmtp") == 0))
{
unsigned i;
/* Time on queue and actual time taken to deliver */
-if ((log_extra_selector & LX_queue_time) != 0)
+if (LOGGING(queue_time))
s = string_append(s, &size, &ptr, 2, US" QT=",
readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
-if ((log_extra_selector & LX_deliver_time) != 0)
+if (LOGGING(deliver_time))
s = string_append(s, &size, &ptr, 2, US" DT=",
readconf_printtime(addr->more_errno));
delivery_log(LOG_MAIN, addr, logchar, NULL);
#ifdef SUPPORT_TLS
- if (tls_out.ourcert)
- {
- tls_free_cert(tls_out.ourcert);
- tls_out.ourcert = NULL;
- }
- if (tls_out.peercert)
- {
- tls_free_cert(tls_out.peercert);
- tls_out.peercert = NULL;
- }
+ tls_free_cert(&tls_out.ourcert);
+ tls_free_cert(&tls_out.peercert);
tls_out.cipher = NULL;
tls_out.peerdn = NULL;
tls_out.ocsp = OCSP_NOT_REQ;
/* Create the address string for logging. Must not do this earlier, because
an OK result may be changed to FAIL when a pipe returns text. */
- log_address = string_log_address(addr,
- (log_write_selector & L_all_parents) != 0, result == OK);
+ log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
/* Create the address string for logging. Must not do this earlier, because
an OK result may be changed to FAIL when a pipe returns text. */
- log_address = string_log_address(addr,
- (log_write_selector & L_all_parents) != 0, result == OK);
+ log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
- if ((log_extra_selector & LX_sender_on_delivery) != 0)
+ if (LOGGING(sender_on_delivery))
s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">");
/* Return path may not be set if no delivery actually happened */
- if (used_return_path != NULL &&
- (log_extra_selector & LX_return_path_on_delivery) != 0)
+ if (used_return_path != NULL && LOGGING(return_path_on_delivery))
s = string_append(s, &size, &ptr, 3, US" P=<", used_return_path, US">");
if (addr->router != NULL)
break;
case '2':
- addr->peercert = NULL;
if (*ptr)
(void) tls_import_cert(ptr, &addr->peercert);
+ else
+ addr->peercert = NULL;
break;
case '3':
- addr->ourcert = NULL;
if (*ptr)
(void) tls_import_cert(ptr, &addr->ourcert);
+ else
+ addr->ourcert = NULL;
break;
# ifndef DISABLE_OCSP
}
/* Local interface address/port */
- if (log_extra_selector & LX_incoming_interface && sending_ip_address)
+ if (LOGGING(incoming_interface) && sending_ip_address)
{
uschar * ptr = big_buffer;
sprintf(CS ptr, "%.128s", sending_ip_address);
int count = Ustrlen(t);
uschar *s = testflag(addr, af_pass_message)? addr->message : NULL;
-if (s == NULL)
- {
- if (addr->user_message != NULL) s = addr->user_message; else return;
- }
+if (!s && !(s = addr->user_message))
+ return;
fprintf(f, "\n %s", t);
-while (*s != 0)
- {
+while (*s)
if (*s == '\\' && s[1] == 'n')
{
fprintf(f, "\n ");
count = 0;
}
}
- }
}
a bounce or a warning message. It tries to format the message reasonably as
required by RFC 3461 by adding a space after each newline
-we assume that this function is only called if addr->host_used is set and if so
-a useable addr->message is available containing some Exim description with ": \n"
-ending, followed by the L/SMTP error message.
+it uses the same logic as print_address_error() above. if af_pass_message is true
+and addr->message is set it uses the remote host answer. if not addr->user_message
+is used instead if available.
Arguments:
addr the address
static void
print_dsn_diagnostic_code(const address_item *addr, FILE *f)
{
-uschar * s;
-
-/* check host_used, af_pass_message flag and addr->message for safety reasons */
-if (!addr->host_used && testflag(addr, af_pass_message) && addr->message)
- return;
+uschar *s = testflag(addr, af_pass_message) ? addr->message : NULL;
-/* search first ": ". we assume to find the remote-MTA answer there */
-DEBUG(D_deliver)
- debug_printf("DSN Diagnostic-Code: addr->dsn_message = %s\n", addr->message);
-if (!(s = Ustrstr(addr->message, ": ")))
- return; /* not found, bail out */
+/* af_pass_message and addr->message set ? print remote host answer */
+if (s)
+ {
+ DEBUG(D_deliver)
+ debug_printf("DSN Diagnostic-Code: addr->message = %s\n", addr->message);
-fprintf(f, "Diagnostic-Code: smtp; ");
+ /* search first ": ". we assume to find the remote-MTA answer there */
+ if (!(s = Ustrstr(addr->message, ": ")))
+ return; /* not found, bail out */
+ s += 2; /* skip ": " */
+ fprintf(f, "Diagnostic-Code: smtp; ");
+ }
+/* no message available. do nothing */
+else return;
-s += 2; /* skip ": " */
while (*s)
if (*s == '\\' && s[1] == 'n')
{
/* Log the end of this message, with queue time if requested. */
- if ((log_extra_selector & LX_queue_time_overall) != 0)
+ if (LOGGING(queue_time_overall))
log_write(0, LOG_MAIN, "Completed QT=%s",
readconf_printtime( (int) ((long)time(NULL) - (long)received_time)) );
else