git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Overhaul the debug_selector and log_selector machinery to support variable-length...
[exim.git]
/
src
/
src
/
smtp_in.c
diff --git
a/src/src/smtp_in.c
b/src/src/smtp_in.c
index cf0a5d64276e32623dd6f26af3d46da4e511d092..998245137f2a65d84de9854dc08b14fcd84fa044 100644
(file)
--- a/
src/src/smtp_in.c
+++ b/
src/src/smtp_in.c
@@
-9,6
+9,7
@@
#include "exim.h"
#include "exim.h"
+#include <assert.h>
/* Initialize for TCP wrappers if so configured. It appears that the macro
/* Initialize for TCP wrappers if so configured. It appears that the macro
@@
-232,6
+233,7
@@
static uschar *protocols[] = {
/* Sanity check and validate optional args to MAIL FROM: envelope */
enum {
/* Sanity check and validate optional args to MAIL FROM: envelope */
enum {
+ ENV_MAIL_OPT_NULL,
ENV_MAIL_OPT_SIZE, ENV_MAIL_OPT_BODY, ENV_MAIL_OPT_AUTH,
#ifndef DISABLE_PRDR
ENV_MAIL_OPT_PRDR,
ENV_MAIL_OPT_SIZE, ENV_MAIL_OPT_BODY, ENV_MAIL_OPT_AUTH,
#ifndef DISABLE_PRDR
ENV_MAIL_OPT_PRDR,
@@
-240,7
+242,6
@@
enum {
#ifdef EXPERIMENTAL_INTERNATIONAL
ENV_MAIL_OPT_UTF8,
#endif
#ifdef EXPERIMENTAL_INTERNATIONAL
ENV_MAIL_OPT_UTF8,
#endif
- ENV_MAIL_OPT_NULL
};
typedef struct {
uschar * name; /* option requested during MAIL cmd */
};
typedef struct {
uschar * name; /* option requested during MAIL cmd */
@@
-260,7
+261,8
@@
static env_mail_type_t env_mail_type_list[] = {
#ifdef EXPERIMENTAL_INTERNATIONAL
{ US"SMTPUTF8",ENV_MAIL_OPT_UTF8, FALSE }, /* rfc6531 */
#endif
#ifdef EXPERIMENTAL_INTERNATIONAL
{ US"SMTPUTF8",ENV_MAIL_OPT_UTF8, FALSE }, /* rfc6531 */
#endif
- { US"NULL", ENV_MAIL_OPT_NULL, FALSE }
+ /* keep this the last entry */
+ { US"NULL", ENV_MAIL_OPT_NULL, FALSE },
};
/* When reading SMTP from a remote host, we have to use our own versions of the
};
/* When reading SMTP from a remote host, we have to use our own versions of the
@@
-1232,8
+1234,7
@@
if (sender_host_unknown || sender_host_notsocket)
if (is_inetd)
return string_sprintf("SMTP connection from %s (via inetd)", hostname);
if (is_inetd)
return string_sprintf("SMTP connection from %s (via inetd)", hostname);
-if ((log_extra_selector & LX_incoming_interface) != 0 &&
- interface_address != NULL)
+if (LOGGING(incoming_interface) && interface_address != NULL)
return string_sprintf("SMTP connection from %s I=[%s]:%d", hostname,
interface_address, interface_port);
return string_sprintf("SMTP connection from %s I=[%s]:%d", hostname,
interface_address, interface_port);
@@
-1258,16
+1259,15
@@
s_tlslog(uschar * s, int * sizep, int * ptrp)
int size = sizep ? *sizep : 0;
int ptr = ptrp ? *ptrp : 0;
int size = sizep ? *sizep : 0;
int ptr = ptrp ? *ptrp : 0;
- if (
(log_extra_selector & LX_tls_cipher) != 0
&& tls_in.cipher != NULL)
+ if (
LOGGING(tls_cipher)
&& tls_in.cipher != NULL)
s = string_append(s, &size, &ptr, 2, US" X=", tls_in.cipher);
s = string_append(s, &size, &ptr, 2, US" X=", tls_in.cipher);
- if ((log_extra_selector & LX_tls_certificate_verified) != 0 &&
- tls_in.cipher != NULL)
+ if (LOGGING(tls_certificate_verified) && tls_in.cipher != NULL)
s = string_append(s, &size, &ptr, 2, US" CV=",
tls_in.certificate_verified? "yes":"no");
s = string_append(s, &size, &ptr, 2, US" CV=",
tls_in.certificate_verified? "yes":"no");
- if (
(log_extra_selector & LX_tls_peerdn) != 0
&& tls_in.peerdn != NULL)
+ if (
LOGGING(tls_peerdn)
&& tls_in.peerdn != NULL)
s = string_append(s, &size, &ptr, 3, US" DN=\"",
string_printing(tls_in.peerdn), US"\"");
s = string_append(s, &size, &ptr, 3, US" DN=\"",
string_printing(tls_in.peerdn), US"\"");
- if (
(log_extra_selector & LX_tls_sni) != 0
&& tls_in.sni != NULL)
+ if (
LOGGING(tls_sni)
&& tls_in.sni != NULL)
s = string_append(s, &size, &ptr, 3, US" SNI=\"",
string_printing(tls_in.sni), US"\"");
s = string_append(s, &size, &ptr, 3, US" SNI=\"",
string_printing(tls_in.sni), US"\"");
@@
-1299,7
+1299,7
@@
smtp_log_no_mail(void)
int size, ptr, i;
uschar *s, *sep;
int size, ptr, i;
uschar *s, *sep;
-if (smtp_mailcmd_count > 0 ||
(log_extra_selector & LX_smtp_no_mail) == 0
)
+if (smtp_mailcmd_count > 0 ||
!LOGGING(smtp_no_mail)
)
return;
s = NULL;
return;
s = NULL;
@@
-2508,8
+2508,8
@@
static void
incomplete_transaction_log(uschar *what)
{
if (sender_address == NULL || /* No transaction in progress */
incomplete_transaction_log(uschar *what)
{
if (sender_address == NULL || /* No transaction in progress */
- (log_write_selector & L_smtp_incomplete_transaction) == 0 /* Not logging */
-
)
return;
+ !LOGGING(smtp_incomplete_transaction))
+ return;
/* Build list of recipients for logging */
/* Build list of recipients for logging */
@@
-2760,7
+2760,7
@@
if (sender_verified_failed != NULL &&
setflag(sender_verified_failed, af_sverify_told);
setflag(sender_verified_failed, af_sverify_told);
- if (rc != FAIL ||
(log_extra_selector & LX_sender_verify_fail) != 0
)
+ if (rc != FAIL ||
LOGGING(sender_verify_fail)
)
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",
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",
@@
-3293,7
+3293,7
@@
while (done <= 0)
pid_t pid;
int start, end, sender_domain, recipient_domain;
int ptr, size, rc;
pid_t pid;
int start, end, sender_domain, recipient_domain;
int ptr, size, rc;
- int c
, i
;
+ int c;
auth_instance *au;
uschar *orcpt = NULL;
int flags;
auth_instance *au;
uschar *orcpt = NULL;
int flags;
@@
-3887,7
+3887,7
@@
while (done <= 0)
if (!extract_option(&name, &value)) break;
for (mail_args = env_mail_type_list;
if (!extract_option(&name, &value)) break;
for (mail_args = env_mail_type_list;
-
(char *)mail_args < (char *)env_mail_type_list + sizeof(env_mail_type_list)
;
+
mail_args->value != ENV_MAIL_OPT_NULL
;
mail_args++
)
if (strcmpic(name, mail_args->name) == 0)
mail_args++
)
if (strcmpic(name, mail_args->name) == 0)
@@
-4066,15
+4066,17
@@
while (done <= 0)
}
break;
#endif
}
break;
#endif
- /*
Unknown
option. Stick back the terminator characters and break
+ /*
No valid
option. Stick back the terminator characters and break
the loop. Do the name-terminator second as extract_option sets
the loop. Do the name-terminator second as extract_option sets
- value==name when it found no equal-sign.
- An error for a malformed address will occur. */
-
default
:
+
value==name when it found no equal-sign.
+
An error for a malformed address will occur. */
+
case ENV_MAIL_OPT_NULL
:
value[-1] = '=';
name[-1] = ' ';
arg_error = TRUE;
break;
value[-1] = '=';
name[-1] = ' ';
arg_error = TRUE;
break;
+
+ default: assert(0);
}
/* Break out of for loop if switch() had bad argument or
when start of the email address is reached */
}
/* Break out of for loop if switch() had bad argument or
when start of the email address is reached */